\n",
"\n",
"# Counting Cluster Sizes\n",
"\n",
@@ -15,70 +15,114 @@
"\n",
"![](https://substackcdn.com/image/fetch/w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F079ab505-66c7-427b-ad6a-a2cf6a1794a6_1600x384.png)\n",
"\n",
- "Altogether there are 20 squares and 9 clusters, so the average cluster size is about 2.22 squares. Under the assumption that every configuration of red and blue squares is equally likely, Zach poses two questions (and I'll add two more):\n",
+ "Altogether there are 20 squares and 9 clusters, so the average cluster size is 20/9 ≈ 2.22 squares. Under the assumption that every square is equally likely to be red or blue, Zach poses two questions (and I'll add three more):\n",
"\n",
"- What is the average cluster size for a grid consisting of a single infinitely long row?\n",
"- What is the average cluster size for a grid consisting of two infinitely long rows?\n",
"- What is the average cluster size for a grid of any given size *w* × *h*?\n",
"- What if there are three or more colors rather than just two?\n",
+ "- If you pick a random square, what is the average size of its cluster?\n",
"\n",
"# Code to Make Grids and to Count Clusters\n",
"\n",
- "My strategy will be to try consider every possible grid of a given size, compute the average cluster size for each grid, and then average across all of them. I'll define two data types and five functions:\n",
- "- `Square`: a pair of `(x, y)` coordinates, e.g. `(2, 1)`.\n",
- "- `Grid`: data type for a grid; a dict of `{square: contents}`, where `contents` initially starts as a color (e.g. `'R'` or `'B'` for red or blue).\n",
- "- `grids(width, height)`: returns a list of all possible grids of the given size. Each grid has a different combination of colors. With *c* colors, there are *c*(*w* × *h*) possible grids of size *w* × *h*.\n",
- "- `one_grid(width, height, colorseq)`: returns one grid of given size, filling in squares with entries from colorseq.\n",
- "- `mean_cluster_size(grid)`: returns the average size of the clusters in a grid.\n",
- "- `cluster(grid)`: Mutates the grid so that each square's contents is changed from a color (a string) to a cluster number, where 1 is the number of the first cluster, 2 of the next cluster, and so on. Uses a [flood fill](https://en.wikipedia.org/wiki/Flood_fill) algorithm.\n",
- "- `neighbors(square)`: the four squares surrounding the given square.\n"
+ "I can see three approaches to answering these questions:\n",
+ "1) Enumerate all possible grids up to a certain size, compute the average cluster size for each grid, and average the averages. This gives an exact answer for grids of a specific size, but it can't say anything about infinite size grids. In fact it starts getting slow for grids with more than about 20 squares, because there are 2*n* grids with *n* squares. \n",
+ "2) Randomly select some grids and average cluster sizes over them. This can handle grids with thousands of squares, but the averages will be only estimates.\n",
+ "3) Come up with a mathematical proof that proves the answer for grids of any width *w*.\n",
+ "\n",
+ "\n",
+ "I can easily write code to implement the first two approaches. I'll start with some imports and the definition of three data types:"
]
},
{
"cell_type": "code",
"execution_count": 1,
- "id": "d3991ae8-4c2c-4e4f-8884-95fd74aec5be",
+ "id": "4ddf868c-8902-49f3-8bdd-79d9377d1a11",
"metadata": {},
"outputs": [],
"source": [
"import itertools \n",
+ "import random\n",
"from statistics import mean, stdev\n",
"from typing import *\n",
"\n",
- "Square = Tuple[int, int]\n",
- "Grid = Dict[Square, Union[str, int]] # e.g. {(1, 1): 1, (2, 1): 'B'}\n",
- "\n",
- "def grids(width: int, height: int, colors='RB') -> List[Grid]:\n",
+ "Square = Tuple[int, int] # A square is a pair of `(x, y)` coordinates, e.g. `(2, 1)`.\n",
+ "Grid = Dict # A dict of `{square: contents}`e.g. {(1, 1): 1, (2, 1): 'B'}\n",
+ "Color = str # A color is represented by a one-character string, e.g. 'R' for red and 'B' for blue\n",
+ "COLORS = ('R', 'B')\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "9a0980a5-2a66-4533-b16c-ad3ab810251a",
+ "metadata": {},
+ "source": [
+ "Now I'll define the function `all_grids` to make a list of all possible grids of a given size (all possible ways to color each square), and `random_grids` to sample `N` different grids of a given size. The helper function `one_grid` makes a single grid from a sequence of colors."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "3fa0280d-3e62-4645-8096-a9156b170ca1",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def all_grids(width: int, height: int, colors=COLORS) -> List[Grid]:\n",
" \"\"\"All possible grids with given width, height, and color set.\"\"\"\n",
" return [one_grid(width, height, colorseq) \n",
" for colorseq in itertools.product(colors, repeat=(width * height))]\n",
"\n",
- "def one_grid(width: int, height: int, colorseq: Sequence[str]) -> Grid: \n",
+ "def random_grids(width: int, height: int, N: int, colors=COLORS) -> List[Grid]:\n",
+ " \"\"\"N grids of size width × height, filled with random colors.\"\"\"\n",
+ " return [random_grid(width, height, colors) for _ in range(N)]\n",
+ "\n",
+ "def random_grid(width: int, height: int, colors=COLORS) -> Grid:\n",
+ " \"\"\"A single random grid.\"\"\"\n",
+ " return one_grid(width, height, [random.choice(colors) for _ in range(width * height)])\n",
+ "\n",
+ "def one_grid(width: int, height: int, colorseq: Sequence[Color]) -> Grid: \n",
" \"\"\"A grid of given size made from the sequence of colors.\"\"\"\n",
" squares = [(x, y) for y in range(height) for x in range(width)]\n",
- " return dict(zip(squares, colorseq))\n",
- "\n",
- "def mean_cluster_size(grid: Grid) -> float: \n",
- " \"\"\"Mean size of clusters in a grid.\"\"\"\n",
- " return len(grid) / max(cluster(grid).values())\n",
- " \n",
- "def cluster(grid: Grid) -> Grid:\n",
- " \"\"\"Do a flood fill, replacing one cluster of adjacent characters with an integer,\n",
- " then incrementing the integer for the next cluster and continuing.\"\"\"\n",
+ " return dict(zip(squares, colorseq))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "fcd29cb3-c7cf-4036-8659-6cd87c116c16",
+ "metadata": {},
+ "source": [
+ "Finally, the function `cluster` mutates the grid so that each square's contents is changed from a color to a cluster number, where 1 is the number of the first cluster, 2 of the next cluster, and so on. It uses a [flood fill](https://en.wikipedia.org/wiki/Flood_fill) algorithm."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "998ba6a6-8355-4474-9f78-92918f18656a",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def cluster(grid: Grid[Square, Color]) -> Grid[Square, int]:\n",
+ " \"\"\"Mutate grid, replacing colors with cluster numbers.\n",
+ " Do a flood fill, replacing one cluster of adjacent colors with an integer cluster number,\n",
+ " then incrementing the cluster number and continuing on to find the next cluster.\"\"\"\n",
" cluster_number = 0 \n",
" for square in grid:\n",
" c = grid[square]\n",
- " if isinstance(c, str):\n",
+ " if isinstance(c, Color):\n",
" cluster_number += 1\n",
- " # Assign cluster number to square and all its neighbors with the same contents\n",
- " Q = [square] # queue of squares in cluster `i`\n",
+ " # Assign `cluster_number` to `square` and all its neighbors of the same color\n",
+ " Q = [square] # queue of squares in cluster `cluster_number`\n",
" while Q: \n",
" sq = Q.pop()\n",
- " if grid.get(sq) == c: \n",
+ " if sq in grid and grid[sq] == c: \n",
" grid[sq] = cluster_number\n",
" Q.extend(neighbors(sq))\n",
" return grid\n",
"\n",
+ "def mean_cluster_size(grids: Collection[Grid]) -> float: \n",
+ " \"\"\"Mean size of the clusters in a collection of grids.\"\"\"\n",
+ " return mean(len(grid) / max(cluster(grid).values()) for grid in grids)\n",
+ " \n",
"def neighbors(square: Square) -> List[Square]:\n",
" \"\"\"The four neighbors of a square.\"\"\"\n",
" (x, y) = square\n",
@@ -92,21 +136,25 @@
"source": [
"# Answering the Questions\n",
"\n",
- "Here's one more function to help solve the questions:"
+ "Here's a function to help answer the questions:"
]
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 4,
"id": "816f854a-7c99-4022-b539-98f87bc20369",
"metadata": {},
"outputs": [],
"source": [
- "def do(n, h=1, colors='RB') -> dict: \n",
- " \"\"\"A dict of {(w, h): mean-cluster-size} for grids with width w from 1 to n, and with height h.\"\"\"\n",
- " for w in range(1, n + 1):\n",
- " μ = mean(map(mean_cluster_size, grids(w, h, colors)))\n",
- " print(f'{w:2} × {h} grids: {μ:6.4f} mean cluster size')"
+ "def do(W, h, N=30_000, colors='RB') -> None: \n",
+ " \"\"\"For each width w from 1 to W, print the mean cluster size of w x h grids.\n",
+ " If `N` is an integer, randomly sample `N` grids.\n",
+ " If `N` is `all`, exhaustively enumerate all possible grids.\"\"\"\n",
+ " which = \"all possible\" if N is all else f\"{N:,d} randomly sampled\"\n",
+ " print(f' Average cluster size over {which} grids of width 1–{W} and height {h}:')\n",
+ " for w in range(1, W + 1):\n",
+ " grids = all_grids(w, h, colors) if N is all else random_grids(w, h, N, colors)\n",
+ " print(f'{w:2} × {h} grids: {mean_cluster_size(grids):6.4f}')"
]
},
{
@@ -116,12 +164,12 @@
"source": [
"# One-Row Grids\n",
"\n",
- "I can't make an infinitely long row (a grid with *n* squares has 2*n* possible color arrangments, it will be slow to investigate grids with more than about 20 squares (a million arrangements)). However, I can look at successively wider rows and see if the average cluster size seems to be converging:"
+ "Let's see what we get. First an exact calculation over all possible grids up to size 14 × 1:"
]
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 5,
"id": "e004289f-0c81-46ab-8900-9312a0aa6f7c",
"metadata": {},
"outputs": [
@@ -129,46 +177,97 @@
"name": "stdout",
"output_type": "stream",
"text": [
- " 1 × 1 grids: 1.0000 mean cluster size\n",
- " 2 × 1 grids: 1.5000 mean cluster size\n",
- " 3 × 1 grids: 1.7500 mean cluster size\n",
- " 4 × 1 grids: 1.8750 mean cluster size\n",
- " 5 × 1 grids: 1.9375 mean cluster size\n",
- " 6 × 1 grids: 1.9688 mean cluster size\n",
- " 7 × 1 grids: 1.9844 mean cluster size\n",
- " 8 × 1 grids: 1.9922 mean cluster size\n",
- " 9 × 1 grids: 1.9961 mean cluster size\n",
- "10 × 1 grids: 1.9980 mean cluster size\n",
- "11 × 1 grids: 1.9990 mean cluster size\n",
- "12 × 1 grids: 1.9995 mean cluster size\n",
- "13 × 1 grids: 1.9998 mean cluster size\n",
- "14 × 1 grids: 1.9999 mean cluster size\n"
+ " Average cluster size over all possible grids of width 1–14 and height 1:\n",
+ " 1 × 1 grids: 1.0000\n",
+ " 2 × 1 grids: 1.5000\n",
+ " 3 × 1 grids: 1.7500\n",
+ " 4 × 1 grids: 1.8750\n",
+ " 5 × 1 grids: 1.9375\n",
+ " 6 × 1 grids: 1.9688\n",
+ " 7 × 1 grids: 1.9844\n",
+ " 8 × 1 grids: 1.9922\n",
+ " 9 × 1 grids: 1.9961\n",
+ "10 × 1 grids: 1.9980\n",
+ "11 × 1 grids: 1.9990\n",
+ "12 × 1 grids: 1.9995\n",
+ "13 × 1 grids: 1.9998\n",
+ "14 × 1 grids: 1.9999\n"
]
}
],
"source": [
- "do(14)"
+ "do(14, 1, all)"
]
},
{
"cell_type": "markdown",
- "id": "13dd529d-519e-487e-9430-e782c8b23e0f",
+ "id": "dda7a929-b903-47e2-891a-d4544dfb86ec",
"metadata": {},
"source": [
- "For rows that are at least 11 squares wide we're getting very close (within 0.001) to an average cluster size of 2.\n",
- "\n",
- "Now that I see the result, I can come up with a justification: Every cluster starts with one square. The next square in the row will be the same color half the time. Continuing, we would get three of the same color in a row a quarter of the time, four in a row an eigth of the time, and so on. So we get:\n",
- "\n",
- "mean cluster size = Σi∈{0,1,...∞} (1/2)n = 2\n",
- "\n",
- "# Two-Row Grids\n",
- "\n",
- "Now consider grids that are two rows tall:"
+ "Let's compare that to the random sampling approach, which can handle wider grids:"
]
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 6,
+ "id": "306d2161-07aa-4b8e-9c54-8462e0a0d6ac",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Average cluster size over 30,000 randomly sampled grids of width 1–20 and height 1:\n",
+ " 1 × 1 grids: 1.0000\n",
+ " 2 × 1 grids: 1.5025\n",
+ " 3 × 1 grids: 1.7502\n",
+ " 4 × 1 grids: 1.8762\n",
+ " 5 × 1 grids: 1.9374\n",
+ " 6 × 1 grids: 1.9726\n",
+ " 7 × 1 grids: 1.9912\n",
+ " 8 × 1 grids: 1.9987\n",
+ " 9 × 1 grids: 1.9960\n",
+ "10 × 1 grids: 2.0011\n",
+ "11 × 1 grids: 1.9928\n",
+ "12 × 1 grids: 1.9976\n",
+ "13 × 1 grids: 2.0020\n",
+ "14 × 1 grids: 1.9991\n",
+ "15 × 1 grids: 2.0034\n",
+ "16 × 1 grids: 1.9952\n",
+ "17 × 1 grids: 1.9995\n",
+ "18 × 1 grids: 1.9984\n",
+ "19 × 1 grids: 1.9925\n",
+ "20 × 1 grids: 2.0022\n"
+ ]
+ }
+ ],
+ "source": [
+ "do(20, 1, 30_000)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "138d8441-b233-457f-97d6-81946e8a07fa",
+ "metadata": {},
+ "source": [
+ "The answer seems to be converging on 2. The random sampling approach has pretty good agreement with the exhaustive approach, always agreeing to within 0.01, and sometimes to within 0.001.\n",
+ "\n",
+ "Now that I see these results, I can describe a mathematical justification of why the limit is 2. In fact, I have two justifications:\n",
+ "\n",
+ "**First**: what is the average number of new clusters introduced per column? Half the time column *k* will be different from the previous column *k* - 1, and thus half the time a column will introduce a new cluster. So with *W* columns there will be *W*/2 clusters, and the average cluster size will be *W*/(*W*/2) = 2.\n",
+ "\n",
+ "**Second**: what is the average length of a cluster that starts in a given column? Every cluster starts with one first square. Half the time, the next square will be the same color, giving two in a row. Continuing, we would get three in a row a quarter of the time, four in a row an eigth of the time, and so on. So using the [formula for the sum of a geometric series](https://en.wikipedia.org/wiki/Geometric_series) we get:\n",
+ "\n",
+ "mean cluster size = Σi∈{0,1,...∞} (1/2)n = 1 / (1 - (1/2)) = 2\n",
+ "\n",
+ "# Two-Row Grids\n",
+ "\n",
+ "Now consider grids that are two rows tall, using both approaches:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
"id": "e2f0c3ca-acac-4dd8-9970-c846e3389ad5",
"metadata": {},
"outputs": [
@@ -176,39 +275,97 @@
"name": "stdout",
"output_type": "stream",
"text": [
- " 1 × 2 grids: 1.5000 mean cluster size\n",
- " 2 × 2 grids: 2.1250 mean cluster size\n",
- " 3 × 2 grids: 2.4688 mean cluster size\n",
- " 4 × 2 grids: 2.6682 mean cluster size\n",
- " 5 × 2 grids: 2.7920 mean cluster size\n",
- " 6 × 2 grids: 2.8737 mean cluster size\n",
- " 7 × 2 grids: 2.9305 mean cluster size\n",
- " 8 × 2 grids: 2.9717 mean cluster size\n",
- " 9 × 2 grids: 3.0027 mean cluster size\n"
+ " Average cluster size over all possible grids of width 1–9 and height 2:\n",
+ " 1 × 2 grids: 1.5000\n",
+ " 2 × 2 grids: 2.1250\n",
+ " 3 × 2 grids: 2.4688\n",
+ " 4 × 2 grids: 2.6682\n",
+ " 5 × 2 grids: 2.7920\n",
+ " 6 × 2 grids: 2.8737\n",
+ " 7 × 2 grids: 2.9305\n",
+ " 8 × 2 grids: 2.9717\n",
+ " 9 × 2 grids: 3.0027\n"
]
}
],
"source": [
- "do(9, 2)"
+ "do(9, 2, all)"
]
},
{
"cell_type": "markdown",
- "id": "8e1ac7a1-f947-4b76-8c5d-d1b26974d018",
+ "id": "de68a7e0-ced6-4c23-a806-3abacfc0927c",
"metadata": {},
"source": [
- "It looks like the answer is converging on 3, but it is not as clear as with the first question.\n",
- "\n",
- "Here's a justification: consider a cluster that extends a certain length all along the top row, with possibly some additional squares below it in the bootom row. You can call this a π-shape, because there is a horizontal bar at the top, and ero or more vertical bars extending down. By the argument above, the average length of the bar is 2. Now for each column in the bar there is a 50% chance that the square below will be the same color and thus join the cluster. So the average cluster size in total is 2 + 2 × 1/2 = 3. By a similar argument, clusters that extend along the bottom row with possibly some squares above also have an average size of 3. But what about an Z-shape or S-shape cluster, which starts along the top (or bottom) row, then switches to the bottom (or top)? The trick is that you can take any Z- or S-shape and turn it into a π-shape by just swapping top and bottom squares when the cluster is on the bottom. This swap doesn't change any probabilities, so a Z-, S-, and π-shaped clusters all have a mean cluster size of 3.\n",
- "\n",
- "# Arbitrary *w* × *h* Grids\n",
- "\n",
- "Let's consider grids of size *n* × 3 and *n* × 4:"
+ "With widths up to 9, the mean is getting close to 3, but I don't think it is converging to exactly 3. "
]
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 8,
+ "id": "c7b56724-5bb7-4395-87b5-0268abb30ff1",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Average cluster size over 30,000 randomly sampled grids of width 1–25 and height 2:\n",
+ " 1 × 2 grids: 1.5005\n",
+ " 2 × 2 grids: 2.1190\n",
+ " 3 × 2 grids: 2.4684\n",
+ " 4 × 2 grids: 2.6611\n",
+ " 5 × 2 grids: 2.7899\n",
+ " 6 × 2 grids: 2.8772\n",
+ " 7 × 2 grids: 2.9399\n",
+ " 8 × 2 grids: 2.9784\n",
+ " 9 × 2 grids: 3.0066\n",
+ "10 × 2 grids: 3.0256\n",
+ "11 × 2 grids: 3.0587\n",
+ "12 × 2 grids: 3.0636\n",
+ "13 × 2 grids: 3.0728\n",
+ "14 × 2 grids: 3.0804\n",
+ "15 × 2 grids: 3.0969\n",
+ "16 × 2 grids: 3.1046\n",
+ "17 × 2 grids: 3.1094\n",
+ "18 × 2 grids: 3.1201\n",
+ "19 × 2 grids: 3.1187\n",
+ "20 × 2 grids: 3.1297\n",
+ "21 × 2 grids: 3.1326\n",
+ "22 × 2 grids: 3.1296\n",
+ "23 × 2 grids: 3.1403\n",
+ "24 × 2 grids: 3.1367\n",
+ "25 × 2 grids: 3.1383\n"
+ ]
+ }
+ ],
+ "source": [
+ "do(25, 2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "90a6dc1c-c570-4bfd-8fe9-210e80c6a455",
+ "metadata": {},
+ "source": [
+ "Now it is clear that the mean is well above 3. At this point I tried to come up with a mathematical analysis but made a mistake. Fortunately, Zach [provides the answer](https://thefiddler.substack.com/p/can-you-eclipse-via-ellipse) by breaking down the possibilities into cases. With the single-row grid, we only needed two cases: column *k* introduced a new cluster 1/2 the time. But with two rows there are 16 cases: each of the two squares in column *k* and the two in column *k* - 1 can be either red or blue. Overall, as aach's diagram below shows, there are 10 new clusters introduced in 16 cases, so the number of new clusters per column is 10/16, and the average cluster size over *W* columns is 2*W* / ((10/16)·*W*) = 16/5 = 3.2.\n",
+ "\n",
+ "![](https://substackcdn.com/image/fetch/w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb06d848c-37f6-4e9b-be38-a88bfe3e7316_1342x1154.png)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "9c0b08ba-7e6b-42ff-884a-5dd010bcfa3a",
+ "metadata": {},
+ "source": [
+ "# Three-Row Grids\n",
+ "\n",
+ "Let's next consider grids of size *n* × 3 :"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
"id": "b29ddec0-5fd2-4f8e-96af-f4b380c6eb59",
"metadata": {},
"outputs": [
@@ -216,39 +373,71 @@
"name": "stdout",
"output_type": "stream",
"text": [
- " 1 × 3 grids: 1.7500 mean cluster size\n",
- " 2 × 3 grids: 2.4688 mean cluster size\n",
- " 3 × 3 grids: 2.8986 mean cluster size\n",
- " 4 × 3 grids: 3.1591 mean cluster size\n",
- " 5 × 3 grids: 3.3266 mean cluster size\n",
- " 6 × 3 grids: 3.4408 mean cluster size\n"
+ " Average cluster size over all possible grids of width 1–6 and height 3:\n",
+ " 1 × 3 grids: 1.7500\n",
+ " 2 × 3 grids: 2.4688\n",
+ " 3 × 3 grids: 2.8986\n",
+ " 4 × 3 grids: 3.1591\n",
+ " 5 × 3 grids: 3.3266\n",
+ " 6 × 3 grids: 3.4408\n"
]
}
],
"source": [
- "do(6, 3)"
+ "do(6, 3, all)"
]
},
{
"cell_type": "code",
- "execution_count": 6,
- "id": "cb493f9f-734e-4767-b245-24cdf906a06a",
+ "execution_count": 10,
+ "id": "7e231093-9e10-446d-8b32-25952b286e1e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- " 1 × 4 grids: 1.8750 mean cluster size\n",
- " 2 × 4 grids: 2.6682 mean cluster size\n",
- " 3 × 4 grids: 3.1591 mean cluster size\n",
- " 4 × 4 grids: 3.4616 mean cluster size\n",
- " 5 × 4 grids: 3.6608 mean cluster size\n"
+ " Average cluster size over 30,000 randomly sampled grids of width 1–25 and height 3:\n",
+ " 1 × 3 grids: 1.7507\n",
+ " 2 × 3 grids: 2.4668\n",
+ " 3 × 3 grids: 2.8953\n",
+ " 4 × 3 grids: 3.1560\n",
+ " 5 × 3 grids: 3.3236\n",
+ " 6 × 3 grids: 3.4452\n",
+ " 7 × 3 grids: 3.5230\n",
+ " 8 × 3 grids: 3.5881\n",
+ " 9 × 3 grids: 3.6304\n",
+ "10 × 3 grids: 3.6695\n",
+ "11 × 3 grids: 3.6897\n",
+ "12 × 3 grids: 3.7266\n",
+ "13 × 3 grids: 3.7455\n",
+ "14 × 3 grids: 3.7636\n",
+ "15 × 3 grids: 3.7772\n",
+ "16 × 3 grids: 3.7995\n",
+ "17 × 3 grids: 3.8018\n",
+ "18 × 3 grids: 3.8090\n",
+ "19 × 3 grids: 3.8220\n",
+ "20 × 3 grids: 3.8290\n",
+ "21 × 3 grids: 3.8318\n",
+ "22 × 3 grids: 3.8514\n",
+ "23 × 3 grids: 3.8500\n",
+ "24 × 3 grids: 3.8580\n",
+ "25 × 3 grids: 3.8639\n"
]
}
],
"source": [
- "do(5, 4)"
+ "do(25, 3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "bf56480e-4bb5-40f9-b1a9-c380eb698046",
+ "metadata": {},
+ "source": [
+ "The mathematical analysis here is much trickier. With two rows, we can tell how many new clusters are introduced in column *k* just by looking at column *k* - 1. But with three or more rows, that's no longer true. Suppose the top and bottom squares in a column are red. Is that one red cluster or two? We have to look a potentially *unbounded* number of columns away to see if they are connected (by a column that has red in all three squares). So no local analysis can determine the number of new clusters per column; we'll need some new method of analysis. \n",
+ "\n",
+ "Interestingly, this is the same limitation that Minsky and Papert noticed in the book [Perceptrons](https://direct.mit.edu/books/monograph/3132/PerceptronsAn-Introduction-to-Computational); their analysis caused many researchers to draw the conclusion that neural networks were no good; they should have instead drawn the conclusion that single-layer neural networks are no good but mult-layer ones avoid the limitations."
]
},
{
@@ -258,12 +447,12 @@
"source": [
"# Adding Colors\n",
"\n",
- "What if we add a third color? That should make the average cluster size smaller (since there is a 2/3 rather than 1/2 chance that the next square will be a different color and start a new cluster). I'll start with a single row:"
+ "What if we add a third color? That should make the average cluster size smaller (since there are more chances for neighboring squares to be different colors). I'll start with a single row:"
]
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 11,
"id": "dc4dc1f5-f5f4-4d69-8bdf-c00d21d978cd",
"metadata": {},
"outputs": [
@@ -271,21 +460,23 @@
"name": "stdout",
"output_type": "stream",
"text": [
- " 1 × 1 grids: 1.0000 mean cluster size\n",
- " 2 × 1 grids: 1.3333 mean cluster size\n",
- " 3 × 1 grids: 1.4444 mean cluster size\n",
- " 4 × 1 grids: 1.4815 mean cluster size\n",
- " 5 × 1 grids: 1.4938 mean cluster size\n",
- " 6 × 1 grids: 1.4979 mean cluster size\n",
- " 7 × 1 grids: 1.4993 mean cluster size\n",
- " 8 × 1 grids: 1.4998 mean cluster size\n",
- " 9 × 1 grids: 1.4999 mean cluster size\n",
- "10 × 1 grids: 1.5000 mean cluster size\n"
+ " Average cluster size over all possible grids of width 1–11 and height 1:\n",
+ " 1 × 1 grids: 1.0000\n",
+ " 2 × 1 grids: 1.3333\n",
+ " 3 × 1 grids: 1.4444\n",
+ " 4 × 1 grids: 1.4815\n",
+ " 5 × 1 grids: 1.4938\n",
+ " 6 × 1 grids: 1.4979\n",
+ " 7 × 1 grids: 1.4993\n",
+ " 8 × 1 grids: 1.4998\n",
+ " 9 × 1 grids: 1.4999\n",
+ "10 × 1 grids: 1.5000\n",
+ "11 × 1 grids: 1.5000\n"
]
}
],
"source": [
- "do(10, 1, 'RGB')"
+ "do(11, 1, all, colors='RGB')"
]
},
{
@@ -293,16 +484,14 @@
"id": "7afd16c2-99bd-410b-b5a8-d20862b7b1f5",
"metadata": {},
"source": [
- "This is straightforward: the mean cluster size converges to 3/2. We can update the equation to deal with a single row with *c* equiprobable colors:\n",
+ "This is straightforward: the mean cluster size converges to 3/2; the analysis says that this is true because each column starts a new cluster 2/3 of the time, on average.\n",
"\n",
- "mean cluster size = Σi∈{0,1,...∞} (1/*c*)n = *c* / (*c* - 1)\n",
- "\n",
- "Now for a two-row grid with three colors:"
+ "Now for a two-row grid with three colors. I'll use random sampling:"
]
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 12,
"id": "37f4a825-d75c-4275-b2c4-6dd3de080b3f",
"metadata": {},
"outputs": [
@@ -310,17 +499,37 @@
"name": "stdout",
"output_type": "stream",
"text": [
- " 1 × 2 grids: 1.3333 mean cluster size\n",
- " 2 × 2 grids: 1.6543 mean cluster size\n",
- " 3 × 2 grids: 1.7737 mean cluster size\n",
- " 4 × 2 grids: 1.8261 mean cluster size\n",
- " 5 × 2 grids: 1.8535 mean cluster size\n",
- " 6 × 2 grids: 1.8698 mean cluster size\n"
+ " Average cluster size over 30,000 randomly sampled grids of width 1–25 and height 2:\n",
+ " 1 × 2 grids: 1.3320\n",
+ " 2 × 2 grids: 1.6609\n",
+ " 3 × 2 grids: 1.7763\n",
+ " 4 × 2 grids: 1.8300\n",
+ " 5 × 2 grids: 1.8569\n",
+ " 6 × 2 grids: 1.8685\n",
+ " 7 × 2 grids: 1.8816\n",
+ " 8 × 2 grids: 1.8874\n",
+ " 9 × 2 grids: 1.8936\n",
+ "10 × 2 grids: 1.9009\n",
+ "11 × 2 grids: 1.9026\n",
+ "12 × 2 grids: 1.9045\n",
+ "13 × 2 grids: 1.9031\n",
+ "14 × 2 grids: 1.9056\n",
+ "15 × 2 grids: 1.9151\n",
+ "16 × 2 grids: 1.9119\n",
+ "17 × 2 grids: 1.9110\n",
+ "18 × 2 grids: 1.9121\n",
+ "19 × 2 grids: 1.9106\n",
+ "20 × 2 grids: 1.9144\n",
+ "21 × 2 grids: 1.9152\n",
+ "22 × 2 grids: 1.9139\n",
+ "23 × 2 grids: 1.9156\n",
+ "24 × 2 grids: 1.9165\n",
+ "25 × 2 grids: 1.9156\n"
]
}
],
"source": [
- "do(6, 2, 'RGB')"
+ "do(25, 2, colors='RGB')"
]
},
{
@@ -328,7 +537,7 @@
"id": "3c18f723-447f-4cd6-ba27-59db37e87659",
"metadata": {},
"source": [
- "By the same reasoning as we had last time, this should converge to 3/2 + 3/2 × 1/3 = 2. (But it would take a lot of computation time to consider the larger grids that would be needed to get closer to 2.)"
+ "This seems to converge to about 1.92. To analye this for the two-color case we had to look at 24 = 16 cases; with three colors we have 34 = 81 cases; I haven't gone through them all to do the calculation. (But you can.)"
]
},
{
@@ -336,197 +545,72 @@
"id": "6a36b07b-8e5c-4048-8046-7619b34f6b26",
"metadata": {},
"source": [
- "# Random Sampling for Larger Grids\n",
+ "# Larger Grids\n",
"\n",
- "I can't analyze an infinite two-dimensional grid.\n",
- "\n",
- "And I can't even enumerate all the, say, 100 × 100 grids, because there are 210,000 of them.\n",
- "\n",
- "But I can **randomly sample** a bunch of 100 × 100 grids, and that should give me a good estimate of the full distribution of grids.\n",
- "\n",
- "First, a function to make a random grid of a given size:"
+ "What about a grid that is unbounded in all directions? I can't fit that into a finite computer, but I can easily examine random grids of size 100 × 100 or more:"
]
},
{
"cell_type": "code",
- "execution_count": 9,
- "id": "51cc5dca-f3b4-4a2b-96af-479683216d4b",
- "metadata": {},
- "outputs": [],
- "source": [
- "import random\n",
- "\n",
- "def random_grid(width: int, height: int, colors='RB') -> Grid:\n",
- " \"\"\"A width × height grid filled with random colors.\"\"\"\n",
- " return one_grid(width, height, [random.choice(colors) for _ in range(width * height)])"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "50ac4938-fd46-4e27-89d0-82bca289f37d",
- "metadata": {},
- "source": [
- "Here's the mean cluster size of one random grid:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 10,
+ "execution_count": 13,
"id": "6abd1ae5-852f-459c-ad6e-1e91d91566b0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "7.037297677691766"
- ]
- },
- "execution_count": 10,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "mean_cluster_size(random_grid(100, 100))"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "197a9c3e-58e4-4a4d-a37f-c793c98f36e8",
- "metadata": {},
- "source": [
- "But that's just one grid. Better to sample *N* different grids (say, *N* = 200) and report on the mean cluster sizes for them:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 11,
- "id": "39fd3321-907d-45eb-b06b-70d590427a09",
- "metadata": {},
- "outputs": [],
- "source": [
- "import matplotlib.pyplot as plt\n",
- "\n",
- "def report(numbers, bins=30) -> dict:\n",
- " \"\"\"Plot a histogram and return statistics on these numbers.\"\"\"\n",
- " plt.hist(numbers, bins=bins, rwidth=0.8, align='left')\n",
- " return dict(mean=mean(numbers), max=max(numbers), min=min(numbers), \n",
- " stdev=stdev(numbers), N=len(numbers))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 12,
- "id": "083dc3ea-a395-4eae-b751-347e4384a373",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "{'mean': 7.239472697041692,\n",
- " 'max': 7.9239302694136295,\n",
- " 'min': 6.6711140760507,\n",
- " 'stdev': 0.19030622926154506,\n",
- " 'N': 200}"
- ]
- },
- "execution_count": 12,
- "metadata": {},
- "output_type": "execute_result"
- },
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAh8AAAGfCAYAAAD/BbCUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAauElEQVR4nO3de4xU5f348c/C4ggKGNRll4ILGqpRDBqxCFXBRlBCtd4aW6sFL4lGvJUYldLGNY2gNPVrDUWjaSlGUVNLrS1WXGu5eL/SGrSKCnVVkIjAgpKlyvP7o2F/riDsrDvPsruvV3IS58yZmQ+PML49M8spSymlAADIpEtbDwAAdC7iA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P7dEvWp7O8R+9UK1xLrkU+/vjjVF1dnSZOnJiee+65tGLFivT444+nt956a6ePO/XUU9Pw4cNTbW1tWrFiRXruuefSU089lWnqvFqyRkuWLEldunRJv/71r9M777yTlixZkg477LB02mmnZZw8jzVr1qRVq1Y1brW1tSki0j/+8Y8dHv/OO++kHj16pCuvvDK99tpr6a677krdunVLDz74YN7BMyp2ja688sp08803p+effz69+eabacqUKalbt27p5Zdfzjt4JsWuzzbr169PBx54YBo7dmwaOnRollnbSkvWqDO9Txe7Pp3pPXpn2iw+rr322nTssccW9Zi//e1vqXfv3mnt2rUlmmr30pI1+uUvf5kOPPDAJvtuu+221L9//9Ycbbd05ZVXpoMOOiht3bp1h/dfc8016ZBDDmmy7+KLL07HHHNMjvF2C7taox059NBD0w033FDCqXYfzV2fs88+O/3sZz9L119/fYePjy/b1Rp1tvfpL9vV+nTm9+gvarOPXR5++OEYNmxYfP/734+Kioo48sgj46677mrWY2bMmBHf+MY34pvf/GZcffXVsXnz5kxT59WSNRo5cmS899578cgjj0RKKT788MN48MEHY/z48ZmmbhtbtmyJe+65Jy644IIdXsAwIuKZZ56JsWPHNtl30kknxYsvvhj//e9/c4zZppqzRl+2devW2LhxY/Tp06fE07W95q7P7Nmz4+23347rr78+43S7h+asUWd7n/6i5qxPZ32P3k5bVU+hUEiFQiFNmTIlvfzyy+mOO+5Ie+65Z5ozZ85XPuakk05KhUIhjR8/Pj333HNp/vz5qbq6Op1//vkZJ8+nJWuUUkp/+MMf0t57753Ky8tTRKRTTz01bdmyJdPUbeOBBx5IXbt2Te+///5XHjN48OB04403Ntn31FNPpYhIH3zwQalHbHPNWaMvmzFjRurTp0/68MMPSzjZ7qE56/Pmm2+mioqK9MYbb6SUUqc789GcNeps79Nf1Nw/Y53xPfrL2iw+unXrlkaMGNFk3+WXX77TU+BjxoxJe+65Z1q/fn3jvj/+8Y+prKwsffrppyWbta20ZI2WLVuWqqqq0owZM9I///nP9Oijj6bDDz88XXDBBaUet02NHTs2ffe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AcAkJX4AACyEh8AQFbiAwDISnwAAFn9PxOJZYoQPFMEAAAAAElFTkSuQmCC\n",
- "text/plain": [
- "