You will also want to keep track of the correlation and mutual information at each possible radius. Probably the easiest way to do this is to use a 15 element array of doubles for each of the three measures. The 15 elements account for each of the possible radii (distances), 0 to 14.

You will also want to keep track of overall entropy and (for 527 students) correlation length (lambda). These variables and the ones mentioned above should all be global.

In order to help automate the process of collecting data, it will be helpful to take in all the parameters on the command line. This includes

You will also need to average over several runs for each set of parameters that you test. Four runs for each should be enough. Each run should have a different random initial state. You may want additional data structures to keep a running total of individual runs so that you can compute their averages for each of the measures.

One way to create an image representing an AICA is to use ASCII art. Simply print the contents of your 30x30 grid to the screen. It the value of the cell is -1, print a space, and if the cell's value is 1, print a *.

A better way of creating an image depicting the AICA is to write code to make a .pgm file. For this, you will need a routine to write data to a file. The top line of the file should read "P2", the second line should read "30 30", and the third line should read "255" (no quotes). The remaining lines will contain the pixel values of the image. Iterate through each cell of your 30x30 grid, and if the cell's value is 1, print "0 " (black) to the file, and if the cell's value is -1, print "255 " (white) to the file. Be sure to include a space after each pixel value, and also write a new line to the file after each row of the grid.

The problem with the .pgm image is that it is only 30x30 pixels and therefore too small to see. One way to fix this is to enlarge the image using an image editing program. Another way is to convert the .pgm image to .jpg format and display it in a web page where the height and width can be specified as in the following command

<img src="myimage.jpg" height=100 width=100 border=1>

Another advantage to creating a web page to display the image is that you can display several images at once, making it easier to compare images with one another. Using this technique will produce images like the following examples.

The

In computing the absolute difference of the x coordinates, first calculate the absolute value of their difference. If this value is <= 15, then keep it as it is. If this value is > 15, then subtract it from 30. This accounts for the fact that the space is a torus where the cell indices are wrapped around on the top and bottom and the left and right sides. Use this same technique to compute the absolute difference of the y coordinates. Then just add these two absolute differences to get the overall distance between the two cells.

This indicates what state cell

The cells will be updated one at a time (asynchronously) as opposed to updating them all at once. So the second cell that gets updated will depend on the update of the first cell, the third cell to be updated will depend on the updates of the first and second cell, and so on. You will want to keep track of which cells have been updated. A 30x30 array of 0's and 1's corresponding to the grid will work.

The updating process can be implemented with a while loop that runs until all cells have been updated. First, randomly choose a cell that has not yet been updated. Then for this randomly chosen cell, iterate through all the other cells of the grid, computing the distance between the two cells. If this distance is <

This updating process is repeated until no cell in the grid has been changed from a given time step to the next. So there are actually two nested while loops involved. The inner loop goes until all cells have been updated, and the outer loop goes until no cell has changed (i.e. the AICA has stabilized). It should only take a few iterations for the AICA to stabilize.

The first term sums over all pairs of distinct cells

Then compute the probability of state value 1 and the probability of state value -1 as follows

Then use these to compute the overall entropy

Note: If Pr{+1} or Pr{-1} is 0, then let their corresponding term in the formula for

After iterating through all the cells, compute the following

Again, use the technique of avoiding taking the log of 0 as described above.

Finally, all the pieces can be combined to obtain the joint entropy for the given distance

Here is a partial listing of possible experiments to run to give you the idea of how to vary the parameters. These are all for experiment 3, so

1. R1=1, R2=2, h=0 2. R1=1, R2=5, h=-4 3. R1=1, R2=5, h=-2 4. R1=1, R2=5, h=0 5. R1=1, R2=5, h=2 6. R1=1, R2=5, h=4 7. R1=1, R2=9, h=-6 8. R1=1, R2=9, h=-3 9. R1=1, R2=9, h=0 10. R1=1, R2=9, h=3 11. R1=1, R2=9, h=6 12. R1=1, R2=14, h=-6 13. R1=1, R2=14, h=3 14. R1=1, R2=14, h=0 15. R1=1, R2=14, h=3 16. R1=1, R2=14, h=6 17. R1=3, R2=5, h=-1 18. R1=3, R2=5, h=0 19. R1=3, R2=5, h=1 20. R1=3, R2=9, h=-6 21. R1=3, R2=9, h=-3 22. R1=3, R2=9, h=0 23. R1=3, R2=9, h=3 24. R1=3, R2=9, h=6 25. R1=3, R2=14, h=-6 26. R1=3, R2=14, h=-3 27. R1=3, R2=14, h=0 28. R1=3, R2=14, h=3 29. R1=3, R2=14, h=6 30. R1=7, R2=9, h=-1 31. R1=7, R2=9, h=0 32. R1=7, R2=9, h=1 33. R1=7, R2=14, h=-3 34. R1=7, R2=14, h=0 35. R1=7, R2=14, h=3 36. R1=12, R2=14, h=-2 37. R1=12, R2=14, h=0 38. R1=12, R2=14, h=2Note the systematic way of varying

Correlation (rho_

Joint entropy (H_

Mutual information (I_

These ranges hold for each of the 3 kinds of experiments.

You should not get any high numbers for these, such as 50 or 80. If you do, then something is wrong with your code.

You should also

Correlation and mutual information are plotted on the same graph to facilitate comparison. The values on the x axis are the possible distances between cells (0 to 14). Part of your analysis might be to find correlations between the shape of the curves in the graphs and the structures in the images.

(Revised 2016-02-12)