Skip to content

Compares the performence of different neural network architectures on the task of predicting the next state in Conway's game of life.

Notifications You must be signed in to change notification settings

FinnBurkhardt/Game-of-Life-with-Neural-Networks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game-of-Life-with-Neural-Networks

Conway's game of life is a cellular automaton, which produces complex behaviors from a few simple rules. This Repository compares the performance of different neural network architectures on the task of predicting the next state in Conway's game of life.

Architectures

1. CNN

The CNN architecture consists out of 2 Layers with 8 and 1 feature maps. A Relu activation function in between and a Sigmoid activation function after the second layer were used.

2. Residual CNN

The residual CNN architecture consists out of 2 Layers with 8 and 1 feature maps. A Relu activation function in between and a Tanh activation function after the second layer were used. The output of the network is added to the previous state to get the next one.

3. MLP

The MPL architecture consists out of 2 fully connected with 256 neurons. A Relu activation function in between and a Sigmoid activation function after the second layer were used.

4. MLP residual

The MPL architecture consists out of 2 fully connected with 256 neurons. A Relu activation function in between and a Tanh activation function after the second layer were used. The output of the network is added to the previous state to get the next one.

Approach

The size of one frame are 16x16 pixels where the value 1 represents a living cell and 0 represents a dead cell. For the training set 5000 series of 30 frames were used. For the validation set 500 series of 30 frames were used. The first state of each series was initialized with a 50% chance for each cell to be alive/dead. To evaluate the predictive power of the neural networks the mean squared error(MSE) between the next state and the predicted next state is calculated.

Results

Comparison of Models during training. The loss for each model is the average over 10 full training runs. image

CNN

CNN

CNN_residual

CNN_residual

MLP

MLP

MLP_residual

MLP_residual

Usage

  1. Install dependencies

  2. Create Data

python3 createData.py
  1. Select wanted model in train.py
  2. Run train.py
python3 train.py

Dependencies

  1. python 3.6
  2. pytorch 1.8.0
  3. numpy
  4. matplotlib

About

Compares the performence of different neural network architectures on the task of predicting the next state in Conway's game of life.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages