Giter Site home page Giter Site logo

williamgilpin / convoca Goto Github PK

View Code? Open in Web Editor NEW
77.0 9.0 21.0 1.12 MB

Predict and analyze cellular automata using convolutional neural networks

Python 69.51% Jupyter Notebook 30.49%
cellular-automata game-of-life convolutional-neural-networks deep-learning

convoca's Introduction

convoca

Demonstrate and learn cellular automata using convolutional neural networks in TensorFlow

Game of Life training stages

The video above shows different stages of training a network to learn Conway's Game of Life. This code both implements and analyzes known CA rulesets using TensorFlow, and it also learns the rules of unknown CA given an image sequence as training data. If you find this code useful, please consider citing the accompanying publication:

Gilpin, William. "Cellular automata as convolutional neural networks." Physical Review E 100.3 (2019): 032402. arXiv

Demos and features

The demos.ipynb illustrates a minimal example of training a CNN on the Game of Life, including example outputs. Models are instantiated using the initialize_model(...) function, which builds a network with a trainable convolutional filter as the first layer, which serves to extract information about the neighborhood of each cell. Repeated 1x1 convolutions in subsequent layers implement the CA rules, and a final softmax layer assigns an output state to each cell. For cases in which the CA ruleset is radially symmetric, the optional SymmetricConvolution layer imposes radially-symmetric structure on the learned convolutional kernels, which is often the case for natural systems with "totalistic" rules. An optional Wraparound2D layer also allows periodic boundary conditions to be implemented in the convolutions.

Installation and Requirements

Install directly from GitHub using

pip install git+git://github.com/williamgilpin/convoca

Typical installation with Miniconda. This code has been tested on macOS and Ubuntu.

  • Python >3.4
  • TensorFlow >2.0
  • numpy
  • matplotlib
  • Jupyter notebooks (for demos)

Structure

The package contains the following libraries

train_ca : requires TensorFlow

ca_funcs : requires TensorFlow

utils : minor functions that support the main methods. Requires numpy only.

demos.ipynb : demonstration of the code for learning the game of live

Updates

As of 2.26.2020, the code has been significantly re-factored to use Tensorflow 2.0 and Keras. The previous implementation has been placed in the "resources" directory, for reference.

Planned future work

  • Add methods for simulating totalistic CA
  • Add methods for Moore neighborhood CA
  • Add demos recreating classic experiments, such as the results in Langton. Physica D, 1990.
  • Add statistical physics calculations such as an efficient calculation of "activity" for a CA
  • CA on graphs using an adjacency matrix --> grid convolutional operator

convoca's People

Contributors

williamgilpin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

convoca's Issues

train CA demo - Dead Kernel

Firstly, wow, this is amazing work! Thank you for sharing this :)

I am trying to run the demo, but my kernel keeps crashing on the third cell:

Screen Shot 2019-06-25 at 2 40 39 PM

Is there some way to fix this? Does me using tensorflow versus tensorflow_gpu make a difference? Or does that simply mean that the specs of my laptop are not good enough:

Screen Shot 2019-06-25 at 2 46 50 PM

Thank you in advanced!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.