You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
structure_graphs/yong_brainsim_randomization...

363 lines
79 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"id": "9b41cf26-d1c2-4e20-97fa-9e51df98b7b9",
"metadata": {},
"source": [
"# Yong (永) Brainsim \n",
"Tribute to BRAINSIM, a neural network on the Commodore 64 \n",
"\n",
"My discussion (with @nickm) on BRAINSIM can be found in the archive of the Critical Code Studies Working Group 2022: https://wg.criticalcodestudies.com/index.php?p=/discussion/117/brainsim-neural-network-on-a-commodore-64-2022-code-critique#latest"
]
},
{
"cell_type": "code",
"execution_count": 160,
"id": "70db2505-37c4-45a0-aca6-94da2f5e310f",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 161,
"id": "28cb06d8-6efe-47c5-932b-7ceeeaa2849f",
"metadata": {},
"outputs": [],
"source": [
"# a representation of \"永\" in matrix notation\n",
"yong_grid = [[0,0,0,0,1,1,0,0,0,0],\n",
" [0,0,1,1,1,1,0,0,1,0],\n",
" [0,0,0,0,0,1,0,1,0,0],\n",
" [0,0,0,0,0,1,1,0,0,0],\n",
" [0,1,1,1,1,1,1,0,0,0],\n",
" [0,0,0,1,0,1,1,0,0,0],\n",
" [0,0,1,0,0,1,0,1,0,0],\n",
" [0,1,0,0,0,1,0,0,1,0],\n",
" [0,0,0,1,0,1,0,0,0,0],\n",
" [0,0,0,0,1,1,0,0,0,0]]"
]
},
{
"cell_type": "code",
"execution_count": 162,
"id": "4fabcbef-6471-46b3-b2d2-a40d175ea5d3",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[0 0 0 0 1 1 0 0 0 0]\n",
" [0 0 1 1 1 1 0 0 1 0]\n",
" [0 0 0 0 0 1 0 1 0 0]\n",
" [0 0 0 0 0 1 1 0 0 0]\n",
" [0 1 1 1 1 1 1 0 0 0]\n",
" [0 0 0 1 0 1 1 0 0 0]\n",
" [0 0 1 0 0 1 0 1 0 0]\n",
" [0 1 0 0 0 1 0 0 1 0]\n",
" [0 0 0 1 0 1 0 0 0 0]\n",
" [0 0 0 0 1 1 0 0 0 0]]\n"
]
}
],
"source": [
"print(np.matrix(yong_grid))"
]
},
{
"cell_type": "code",
"execution_count": 163,
"id": "2c97a665-f732-4e6a-a65d-15230f4c4b34",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPgAAAD7CAYAAABHRVmlAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAANXUlEQVR4nO3dX0jdBdzH8c9R0aYhZ7rclDmlyOEeaA4H7oFBYWveqPVcWbJ10ZbEmJk01hqUU6llBSro0kU3RXQR9EjZhQVKsLGNCIuZ7g/+S5jO5jZmXjjU33PxgDx7Nj2/k+fn75wv79ed+MPz4Xje/c7056+A4ziOAJgU5/cAAN4hcMAwAgcMI3DAMAIHDCNwwDACBwxLWJdH+fML6f690MftqpX6m73fEwlRsDX3v1pdHzs2Nqbc3FzvxrjZ8N817g6Mguc2LH7uTUyV/uPQip9en8Dv35Pm77o71u1x0cDnrePj454eH3HhPF+x9DqQonYvb9EBwwgcMIzAAcMIHDDMVeCjo6OqqKhQSUmJKioqNDY25vEsAJHgKvC6ujpVVlaqp6dHlZWVev/9973eBSACQgY+MzOjwcFBlZaWSpJKS0s1ODio27dvez4OwNqEDHxyclKbN29WfHy8JCk+Pl4ZGRmanJz0fByAtVmfC1121bo/dk+9dzsizeetjhPe48fUzXti6XUgRe3ekIFnZmbq5s2bWlxcVHx8vBYXFzU9Pa3MzEz3j9Lf7O5Knz310sU691/XT1GwNfCfDa6PdRxHgUDAwzUuNlxw+bObKHhuw+Ln3qTgqifQkG/R09PTlZ+fr+7ubklSd3e38vPzlZaWFrGNALzh6i36qVOndOLECZ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32m95++239+OOPSklJWa+dAP6FkGfwoaEhTU9Pq7CwUJJUWFioDRs2aHh4WM8884y7R+lvlubvhj5uT710sc7d1/RbGFuj4o9NYmlvLL0OJH/3JgWlXbUrfjrkP6S3bNmiqakpjYyMSJKGh4d169Ytbdu2LWIbAXgj5Bn8iSee0KlTp1RTU6NAICBJOn36tILBoNfbAKyRq9+Dl5eXq7y83OstACKM33UBhhE4YBiBA4YROGAYgQOGxexdVWOJV3fcDOeCFMep9+wCFkQvzuCAYQQOGEbggGEEDhhG4IBhBA4YRuCAYQQOGEbggGEEDhhG4IBhBA4YRuCAYQQOGEbggGEEDhhG4IBhBA4YRuCAYQQOGLY+N11MTHV/bFLQsxkR5/PWnJwcT4+PuHCer1h6HUj+7Q3RVsj/PziA2MVbdMAwAgcMI3DAMAIHDCNwwDACBwwjcMAwAgcMI3DAsKgIfHR0VBUVFSopKVFFRYXGxsb8nvRId+7c0euvv66SkhKVlZXp6NGjun37tt+zXGlra9P27dt17do1v6esaH5+XnV1ddq/f7/Kysr03nvv+T1pVX19fXrppZf04osvqqysTD/99JPfkx7mRIGDBw86XV1djuM4TldXl3Pw4EGfFz3anTt3nIsXLy5//NFHHznvvvuuj4vcGRgYcA4dOuQ899xzztWrV/2es6LGxkbngw8+cJaWlhzHcZy///7b50UrW1pacnbv3r38fA4NDTkFBQXO4uKiz8se5PsZfGZmRoODgyotLZUklZaWanBwMCrPjMFgUEVFRcsfFxQU6MaNGz4uCu3+/ftqaGhQXV2dAoGA33NWNDc3p66uLtXU1Czv3LRpk8+rVhcXF6fZ2VlJ0uzsrDIyMhQX53tSD1ifvyZbxeTkpDZv3qz4+HhJUnx8vDIyMjQ5Oam0tDSf161saWlJ33zzjYqLi/2esqrW1laVl5crOzvb7ymrmpiYUDAYVFtbmy5duqSUlBTV1NRo9+7dfk97pEAgoJaWFh05ckTJycmam5tTZ2e
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from matplotlib import pyplot as plt\n",
"im = plt.imshow(yong_grid, cmap=\"copper_r\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 164,
"id": "88b311f4-e2cc-494d-9e24-714816303460",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAWQAAAD/CAYAAADGzawUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAm80lEQVR4nO3dfVRVVf4/8DdcosDxgqAgqJMPTUZN6qjzdaYHdRDEVSjSVBba8jcWNinUmOUDmoBYRt9pTEXNLI0Gxxq/NRaMP7WG+vnFKXP1JAY1ifh8AXnyKqjIvef3h0uSgMu5ngf32bxfrbNWXA/ns/fp9Fnbffc+Hx9FURQQEdE153utG0BERJcwIRMRCYIJmYhIEEzIRESCYEImIhIEEzIRkSCYkImIvJCdnY3o6GgMHjwY//nPf9o9x+VyITMzEzExMYiNjcXWrVtVXZsJmYjIC+PGjcPmzZvRp0+fDs/Jz8/H0aNHsWvXLrzzzjtYvXo1jh8/3um1mZCJiLwwcuRIREREeDxn+/bteOCBB+Dr64uQkBDExMRgx44dnV7bT69GEhFZldPphNPpbPO53W6H3W73+noOhwORkZEtP0dERKCioqLT3zM1Ifv5dzzEJ7GcO/m/17oJuguIvPtaN4G80Nx0QtPvX6w+pPrc3C3/RE5OTpvPU1JSkJqaqqkd3uAImYjk5HapPnX69OlITExs8/nVjI6BSyPikydPYsiQIQDajpg7woRMRHJyNas+9WqnJjoyYcIEbN26FePHj0d9fT0++ugjbN68udPf45d6RCQlRXGrPryxbNkyjB49GhUVFfjDH/6Ae++9FwCQnJyM4uJiAEBCQgL69u2L8ePH48EHH8Ts2bPRr1+/Tq/tY+brNzmHbB2cQ6ZrTescctPxYtXn+ve9XVMsvXDKgojk5OXIVwTCTln06BGM/9n6Ok7X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iIqKgoFBQUAgIKCAkRFRbWargCAvn37Yvfu3QCApqYmfPrpp/jFL37R6fWZkIlITgatssjIyEBeXh7i4uKQl5eHzMxMAEBycjKKi4sBAGlpafjiiy8wceJETJ48Gf3798eDDz7Y6bU9vstCbzK+y4K0M+sLMDO//OKXetppfZdF4+pZqs8NTF2rKZZehB0hy1jx18xYMvYJkLNqsox9MjtWu2R7Qf21JGPFXzNjydgnQM6qyTL2yexY7bLgy4WEnLIIDAxAdVUJhv5qXEuRxDc3rcLJkw6kLVqua5tkjGW1Pl3NX+9XvZaLyqpqPL94rurf8eav9lr7ZVafAPX9stpzoXnK4i/Jqs8NfHqDplh6EXLKQtaKv2bFkrFPZpOxX13uuXAr6g9BeEzIdXV1WLRoEWbMmIHNmze3+rMrd6/oTdaKv2bFkrFPZpOxX13uuTBolYWRPCbk9PR0BAUF4aGHHsJHH32ElJQUNDc3AwCOHTtmWKNkrfhrViwZ+2Q2GfvV1Z4Lxe1WfYjCY0I+cuQI5s2bh/Hjx2Pjxo3o1asXHn/8cVy4cMHQRl1ZsfYyMyr+yhJLxj6ZTcZ+dbnnQrYpi6amH7/x9fHxQXp6Om6++WbMnDnT0KR8ZcXawMAA3PHbkZg0cTzyNr/LWALFMTsWcKlq8oULTa2qJjc36/9XTjP7JWOfzH4u2qW41R+C8JiQ+/Xrh3379rX6bP78+Rg2bBgOHz5sZLuQkpqGgIAb4DixH3l/XWt4xV/ZYsnYJ+BS1eQR0Ql4I+/vKNhZiBHRCVifu8WQWGb1S8Y+mR2rXRYcIXtc9lZfXw8fHx8EBQW1+bODBw/ipptu8ioYd+pRe7hTTxvu1Gtfw5KHVJ/bbenbmmLpxePGkODg4A7/zNtkTERkKoGmItQSdqceEZEmAk1FqMWETERSEmk5m1pMyEQkJ46QiYgEwYR
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import seaborn as sns; sns.set()\n",
"ax = sns.heatmap(yong_grid, annot=True, fmt=\"d\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 165,
"id": "9f113e8b-b4f3-4633-ae25-0c8f52cd9131",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"1\n"
]
}
],
"source": [
"# access item in matrix\n",
"# notation is [column][row]\n",
"print(yong_grid[0][4])\n",
"print(yong_grid[0][5])"
]
},
{
"cell_type": "code",
"execution_count": 166,
"id": "432f0ba2-6e6f-4e75-92b0-60edfa334e91",
"metadata": {},
"outputs": [],
"source": [
"twenty_p_one = [1,1,0,0,0,0,0,0,0,0]\n",
"twenty_p_zero = [0,0,1,1,1,1,1,1,1,1]"
]
},
{
"cell_type": "code",
"execution_count": 167,
"id": "b8de1127-f19b-4c9b-a8e2-f199af0cc965",
"metadata": {},
"outputs": [],
"source": [
"import random\n",
"import math\n",
"z_count = 0\n",
"one_count = 0\n",
"import math\n",
"for i in range(10):\n",
" for j in range(10):\n",
" if yong_grid[i][j] == 0:\n",
" # reassign\n",
" yong_grid[i][j] = random.choice(twenty_p_one) \n",
" else:\n",
" yong_grid[i][j] = random.choice(twenty_p_zero) "
]
},
{
"cell_type": "code",
"execution_count": 168,
"id": "a650e08a-9a56-45ca-b230-e3c15308d4e4",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAWQAAAD/CAYAAADGzawUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAnSklEQVR4nO3dfVRVVf4/8DdcosDxgqAgqOXTaNikjjrjTA/qIIirUKQnC235GwubFGrMUkMTEMxopjETNbM0DMdp/NZYMH7VGurnDytz9aQGNYn4fAF58gqowLnn94dLEoHLuZ57jvtu369ZZy25nns/ex9On9nuu/f5eKmqqoKIiK4572vdACIiuogJmYhIEEzIRESCYEImIhIEEzIRkS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XdXdfyDZl0dj48ze+Xl5eSE1NxaBBgzBr1ixDk/LlFWv9/f1wx+9HYfKkCcjd/B5jCRTH7FjAxarJFy40tqqa3Nzs/n9ymtkvGftk9n3RLtWh/RCE04Tcp08f7Nu3r9VrCxYswPDhw3HkyBEj24Wk5BT4+d0E28n9yH1njeEVf2WLJWOfgItVk0dGxuGt3H8if2cBRkbGYV3OFkNimdUvGftkdqx2eeAI2emyt9raWnh5eSEgIKDN3x06dAgDBw50KRh36lF7uFNPH+7Ua1/9koc1n9tl6T90xXIXpxtDAgMDO/w7V5MxEZGpBJqK0ErYnXpERLoINBWhFRMyEUlJpOVsWjEhE5GcOEImIhIEEzIRkSAE2hKtFRMyXTe4FO364kpNPVEwIRORnJiQiYg
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"ax = sns.heatmap(yong_grid, annot=True, fmt=\"d\")"
]
},
{
"cell_type": "code",
"execution_count": 169,
"id": "539a820f-d146-441f-add1-329c76b73e4c",
"metadata": {},
"outputs": [],
"source": [
"# lists for 5%, 10% and 15% randomization\n",
"five_p_one = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]\n",
"five_p_zero = [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]\n",
"ten_p_one = [1,0,0,0,0,0,0,0,0,0]\n",
"ten_p_zero = [0,1,1,1,1,1,1,1,1,1]\n",
"fifteen_p_one = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0]\n",
"fifteen_p_zero = [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1]"
]
},
{
"cell_type": "code",
"execution_count": 170,
"id": "0bcb9ea5-8cca-429b-8c23-65ff435d7592",
"metadata": {},
"outputs": [],
"source": [
"# random image generator\n",
"# generate heatmap and save in folder \n",
"def randImg(list_zero, list_one):\n",
" z_count = 0\n",
" one_count = 0\n",
" for i in range(10):\n",
" for j in range(10):\n",
" if yong_grid[i][j] == 0:\n",
" yong_grid[i][j] = random.choice(list_zero) \n",
" else:\n",
" yong_grid[i][j] = random.choice(list_one) \n",
" ax = sns.heatmap(yong_grid, annot=True, fmt=\"d\")\n",
" # clear randomization; reassign var yong_grid hold values of original text input matrix"
]
},
{
"cell_type": "code",
"execution_count": 171,
"id": "95d3568c-082a-4343-80b9-9004521817bc",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAWQAAAD/CAYAAADGzawUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAli0lEQVR4nO3df1RUdf4/8OcwSIk5ICgIavlrNWpTV23dstRFEE+hSFvZoh6/a0FnFWotU1Pjh1BGn901E63sh2uLuX7dSoX1q9ZSX7+4ZZ1+iaGtIvlzAPnlKJjInfv9wyNJDMO93rmXe98+H505R8bLvO69M7169577vk+bLMsyiIio0/l19g4QEdFlbMhERCbBhkxEZBJsyEREJsGGTERkEmzIREQmwYZMRKRCbm4uoqOjMXToUPz3v//1uI0kScjKykJMTAxiY2OxZcsWRa/NhkxEpMLEiROxceNG9OnTp91tCgoKcPz4cezevRubN2/G6tWrcfLkyQ5fmw2ZiEiF0aNHIyIiwus2O3bswEMPPQQ/Pz+EhIQgJiYGO3fu7PC1/X21k0REVuVyueByudo873A44HA4VL+e0+lEZGRky88RERGoqKjo8PcMbciXqo8aWY406Bp5b2fvgs9dOP3/OnsXSIUuPQdq+n01/WbDpn8hLy+vzfOpqalIS0vTtB9qcIRMRGJyS4o3nT17NhITE9s8fy2jY+DyiPj06dMYNmwYgLYj5vawIRORmKRmxZte69REeyZPnowtW7Zg0qRJqK+vx0cffYSNGzd2+Hv8Uo+IhCTLbsUPNXJycjBu3DhUVFTgD3/4A+6//34AQHJyMkpKSgAACQkJ6Nu3LyZNmoSHH34Y8+bNQ79+/Tp8bZu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hMREYHKykpIkgS73Q5JklBVVYWIiIhW2+Xn5+OFF16An58funfvjujoaOzbt6/Dhswv9YhITDrc7S00NBRRUVEoLCwEABQWFiIqKqrVdAUA9O3bF3v27AEANDU14dNPP8UvfvGLDl+fDZmIxKTTVRaZmZnIz89HXFwc8vPzkZWVBQBITk5GSUkJAGDJkiX48ssvMWXKFEybNg39+/fHww8/3OFre72Xha+JeC8L0k7Ee1nwSz3tuvQcqOn3G1fPVbxtYNpaTbV8xbQjZBFTp1lLOxFTpwExj8voc9iGaDeo70wipk6zlnYipk4DYh6X0eewDd5cyHdiJ4wFAHx36DAqq6otX4e1tLuSZDz8VxPbJBkvWbrCp7WMPH+iHpeRtTwy0chXKdNOWRD9nCmSjHUg6nF1Ores/GESXhtyXV0dli5dijlz5mDjxo2t/u7q1StERjBFkrEORD2uTqfTVRZ68tqQMzIyEBQUhEceeQQfffQRUlNT0dzcDAA4ceKEITtIdIUpkox1IOpxdTbZ7Vb8MAuvDfnYsWNYuHAhJk2ahLfffhu9evXC448/josXLxq1f0Qtrk4yvkKE1GlRj6vTiTZl0dT00zejNpsNGRkZGDJkCFJSUnRvys3NEi5ebGqVxNvc7Pv/tTCqDmtpd3WScWBgV9x912hMnTIJ+Rvf83ktI8+fqMdlZC2PZLfyh0l4XRiSkpKC5ORk3Hnnna2eX7lyJdatW4eDBw+qKqZmYciat/JbJfEC0CWJ16g6rNU+NYsoevQIxptv/AUxE8ehpqYOS5a9gH/8Y6ui31WzgMLIYwKsc1xqaK2ldWFIw/IZirftlr6x440M4LUh19fXw2azISgoqM3fHTlyBIMHD1ZVjCv1yBOu1NOGK/U8a0h/RPG23Zb/Q1MtX/F6HXJwcHC7f6e2GRMRGcpEUxFKmXZhCBGRJib6sk4pNmQiEpKZLmdTig2ZiMTEETIRkUmwIRMRmYSJlkQrxYZM1w1einZ9UZOpZxZsyEQkJjZkIiKT4FU
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# call function with 5%\n",
"# clear randomization; reassign var yong_grid hold values of original text input matrix\n",
"yong_grid = [[0,0,0,0,1,1,0,0,0,0],\n",
" [0,0,1,1,1,1,0,0,1,0],\n",
" [0,0,0,0,0,1,0,1,0,0],\n",
" [0,0,0,0,0,1,1,0,0,0],\n",
" [0,1,1,1,1,1,1,0,0,0],\n",
" [0,0,0,1,0,1,1,0,0,0],\n",
" [0,0,1,0,0,1,0,1,0,0],\n",
" [0,1,0,0,0,1,0,0,1,0],\n",
" [0,0,0,1,0,1,0,0,0,0],\n",
" [0,0,0,0,1,1,0,0,0,0]]\n",
"randImg(five_p_zero, five_p_one)\n"
]
},
{
"cell_type": "code",
"execution_count": 172,
"id": "506f97b0-e44d-401c-81b5-6d43d9933944",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAWQAAAD/CAYAAADGzawUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAmUklEQVR4nO3df1RVVf438DdcosS8/FIQtPJHo2GTOmrjtyx1EMRVKNpUNmjLZyzoGYUay9TQ+CGU0UxjjmillYODWV+/NSqMj1pDPT44Za1+qaGNIvnzAvLLK6AC957nD5ckApdzPfcc9tm8X7POWnI993z2Phc/s9t37/PxUhRFARERdTnvrm4AERFdxoRMRCQIJmQiIkEwIRMRCYIJmYhIEEzIRESCYEImInJDdnY2IiMjMXToUPznP/9p9xyHw4GMjAxERUUhOjoaW7ZsUXVtJmQiIjdMmjQJmzZtQr9+/To8Jz8/HydOnMDu3bvxwQcfYPXq1Th16lSn12ZCJiJyw5gxYxAWFubynB07duCRRx6Bt7c3goKCEBUVhZ07d3Z6bR9PNZKIyKzsdjvsdnub161WK6xWq9vXs9lsCA8Pb/k5LCwMZWVlnb7P0ITcVHnMyHCkQY/w+7u6CR534cz/6+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xvu1Gtffepjqs/tufx9TbE8xeU65ICAgA7/zt1kTERkKIGmItQSdmMIEZEmAn1ZpxYTMhFJSaTlbGoxIRORnDhCJiISBBMyEZEgBNoSrZahCZnLm7SRdXmTUfhZaWfkPWxuPK3p/e7U1BMFR8hEJCcmZCIiQXCVBRGRIDhCJiISBBM
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# call function with 10%\n",
"yong_grid = [[0,0,0,0,1,1,0,0,0,0],\n",
" [0,0,1,1,1,1,0,0,1,0],\n",
" [0,0,0,0,0,1,0,1,0,0],\n",
" [0,0,0,0,0,1,1,0,0,0],\n",
" [0,1,1,1,1,1,1,0,0,0],\n",
" [0,0,0,1,0,1,1,0,0,0],\n",
" [0,0,1,0,0,1,0,1,0,0],\n",
" [0,1,0,0,0,1,0,0,1,0],\n",
" [0,0,0,1,0,1,0,0,0,0],\n",
" [0,0,0,0,1,1,0,0,0,0]]\n",
"randImg(ten_p_zero, ten_p_one)"
]
},
{
"cell_type": "code",
"execution_count": 173,
"id": "bf3dd55e-6614-4b9d-9e99-8e81f957bfa9",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAWQAAAD/CAYAAADGzawUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAl1klEQVR4nO3de1RVZf4/8DccosQ8ICgIWnmbDJvUURunmzoI4ioUaSobtOVvLGiNQo1d1NC4CGX0ncYcUcsuDg5mfv1WJuRXraF+/nDKWt3UwEaRvB5Abh4FFThn//5wSRJw2Nt99j7PeXy/WnstOeyzP8+zz/bT43P2sz8+iqIoICIij/P1dAOIiOgiJmQiIkEwIRMRCYIJmYhIEEzIRESCYEImIhIEEzIRkQa5ubmIiorCsGHD8J///KfTfRwOB7KyshAdHY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5Xsba11f3/tDArDmPpd3nV5ICAHrjzjrGYNnUyCja85/ZYZp4/WftlZqxOKU71myBcLgxJTk5GUlISbr/99navL1++HGvXrkVZWZmmYFoWhqx6q6BdxVoAhlSsNSsOY3VNyyKK3r2D8OYbryB60njU1tYjbcmLePfdLareq2UBhZl9ArynX1rojaV3YUjj0pmq9+2ZvqH7nUzgMiE3NDTAx8cHgYGBHX536NAhDB06VFMwrtSjznClnj5cqde5xvSHVe/bc+m7umK5i8v7kIOCgrr8ndZkTERkKoGmItQSdmEIEZEuAn1ZpxYTMhFJSaTb2dRiQiYiOXGETEQkCCZkIiJBCLQkWi0mZOqUjJWgeSva1UVLTT1RMCETkZyYkImIBMG7LIiIBMERMhG
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# fifteen percent\n",
"yong_grid = [[0,0,0,0,1,1,0,0,0,0],\n",
" [0,0,1,1,1,1,0,0,1,0],\n",
" [0,0,0,0,0,1,0,1,0,0],\n",
" [0,0,0,0,0,1,1,0,0,0],\n",
" [0,1,1,1,1,1,1,0,0,0],\n",
" [0,0,0,1,0,1,1,0,0,0],\n",
" [0,0,1,0,0,1,0,1,0,0],\n",
" [0,1,0,0,0,1,0,0,1,0],\n",
" [0,0,0,1,0,1,0,0,0,0],\n",
" [0,0,0,0,1,1,0,0,0,0]]\n",
"randImg(fifteen_p_zero, fifteen_p_one)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c9a8f88b-6b44-4587-a4b8-46ed9fd26b14",
"metadata": {},
"outputs": [],
"source": [
"# TODO\n",
"# clear randomization; reassign var yong_grid hold values of original text input matrix\n",
"# add annotation to specify level of randomization \n",
"# run 100 times and save pictures"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
2 years ago
"version": "3.10.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}