Message Boards Message Boards

[MENTORSHIP] Identify Cellular Automaton Classes with Machine Learning

Posted 8 years ago

NOTE: The complete notebook of this post is attached at the end.


During the time while I worked on this project, I learned not only a great deal about cellular automaton, but machine learning algorithms in general. Before I started the mentorship program, I had the opportunity to participate in the Wolfram Mathematica Summer Camp in 2015. There I became extremely interested in Mathematica and machine learning. This was a mentorship project since the topic of cellular automaton is quite difficult to learn alone. So with the help of a mentor, I was able to learn more about cellular automaton as well as work hands on with them. Please see the attached file for all of the information. Thanks.

Background Information

Cellular Automaton

Cellular automaton are defined as mathematical models for complex natural systems containing large numbers of identical components with local interactions. Automaton consist of a lattice of sites, each with a finite set of possible values. These values, the value of each site, evolve synchronously in discrete time steps according to identical rules. Additionally, the value of each site is determined by the previous values of the neighborhood sites around it. Even though these automaton are simply defined, it has been shown that they can consist of complex behaviors.

Classes of Cellular Automaton

Stephen Wolfram proposes a class system. This system has four different classes: class I, II, III, and IV. Class I is defined to have very simple behavior, and that almost all initial conditions lead to exactly the same uniform final state of the cellular automaton. Some examples of class I cellular automata are rules 0, 32, and 160.

Class II cellular automaton show many different possible final states, but all consist of a certain set of simple internal structures that must either: (1) remain the same forever, or (2) repeat every few steps. Examples of this class are rules 4, 108, and 250.

Class III automaton have a more complex behavior. There seems to be an aspect of randomness, although triangles and other small-scale structures are seen at some levels. Examples are rules 22, 30, and 150.

Class IV involves a complex mixture of order and randomness. There are localized structures that are produced which seem fairly simple, but these structures move and interact in very complicated ways. An example of this class is rule 110.

Part 1: Understanding the Behavior of all 4 Classes

Before creating a classifier, it is necessary to determine how to distinguish the 4 classes from each other. There are stark differences between classes 1 and 2, and classes 3 and 4. This difference is a mathematical difference so a test can be run on the automaton to check and see if it is class 1 or 2, or class 3 or 4. Examples of all 4 classes are shown below.


This is an example of a class 1 cellular automaton.

enter image description here


This is an example of a class 2 cellular automaton.

enter image description here


This is an example of a class 3 cellular automaton.

enter image description here


This is an example of a class 4 cellular automaton.

enter image description here

The test created checks to see if the automaton has a set cycle where the pattern in creates repeats itself. The following code excerpt shows how the test was created.


       If[Not[Apply[SameQ,h[[-1]]]||CyclicCylcingQ[h]],Throw[res="3 or 4"]];

However, to determine the difference between classes 3 and 4, some image processing techniques were necessary. Additionally, the use of ClassifierFunction was necessary.

Part 2: Identifying the Best Image Processing Functions to Build a Classifier

Creating test images from all 3 color totalistic cellular automaton

As a base case for the project, all 3 color totalistic cellular automaton were used. There are a total of 2187 of them, and a few class 3 and class 4 CAs were picked out. The creation of the images is shown below along with the rules used.


Creating a function to classify test images with a specific filter

The function created works on the set "testimages" and is able to use any image association and its specification. Additionally, an accuracy function was created in order to measure how accurate the filter was at identifying the cellular automaton. These functions are shown below.

AccuracyTest0[filter_,classifier_,Automatic,measurement_,o:OptionsPattern[]]:=AccuracyTest0[filter,classifier,<|"3"->testimages3[[;;35-8]],"4"->testimages3[[35-8+1;;]]  |>,measurement,o]

Examples of how to use ClassifyWithFilter and the best Image Processing functions that were found

Rotate 45 Degrees

imageRotate45DegFilter=ImageRotate[#,45 Degree]&;








Part 3: The Errors

Throughout the whole extent of this project, there was one large error. Every time an accuracy test was run, the seed for generating the CAs changed. This made all accuracy tests unreliable. This was as far as the research was conducted due to time constraints. However, please feel free to pick up this project as it is quite promising.

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming, and consider contributing your work to the The Notebook Archive!

POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract