Giter VIP home page Giter VIP logo

cartpole-neat's Introduction

Build Status codebeat badge Maintainability Codacy Badge codecov

CartPole-NEAT

In this project I aim to implement NEAT in python. Then I will try solve the CartPole problem using it. I will use OpenAI Gym's environment for this. I also plan to make this program multi-threaded so that I can have multiple runs (with possibly different configurations) running in parallel.

I also want to make a supporting web application that will handle real-time plotting as I have found matplotlib to be a bit lacking in that area. This as an opportunity to practice some web development skills and learn some new tech. This web application would be a RESTful application served locally from a flask server running in docker container, backed by MongoDB or possibly PostgreSQL. For the front end of things I will probably use a combination of Twitter Bootstrap, React, and JavaScript Live.

Check out the wiki pages for relevant resources and the projects page to see the progress of brainstorming, planning, and implementation. This project is split up into three subprojects: the actual genetic algorithm implementation, the RESTful API that provides access to test data, and the dashboard that provides visualizations of previous runs and a real time visualization test runs that are in progress. Each subproject contains a README.md with further details.

Test Suite

I intend on building up a test suite as I go. This can be run with the 'test_suite.sh' script, although you probably don't need to do this yourself since Travis CI does this for you.

cartpole-neat's People

Contributors

anthonydickson avatar

Stargazers

 avatar  avatar

Watchers

 avatar

cartpole-neat's Issues

Bottleneck in Graph Compilation

Marking recurrent connections gets very slow once the creature phenotypes get more complicated (see image below). Need to find a way to optimise this part if possible.

cartpole-neat_profiling_call_graph

Fix API endpoints

Navigating to the end point /users/foo leads to a nice error screen and gives the following:

sqlalchemy.exc.DataError

sqlalchemy.exc.DataError: (psycopg2.DataError) invalid input syntax for integer: "foo"
LINE 3: WHERE "user".id = 'foo'
^
[SQL: 'SELECT "user".id AS user_id, "user".username AS user_username, "user".email AS user_email \nFROM "user" \nWHERE "user".id = %(id_1)s \n LIMIT %(param_1)s'] [parameters: {'id_1': 'foo', 'param_1': 1}] (Background on this error at: http://sqlalche.me/e/9h9h)

It should handle this a bit more gracefully, e.g. returning a 404 or something.

Program Multithreading

For example, on a quad core system one could run four genetic algorithms in parallel and then choose the best of the four.

Convolutions in Graphs

Given an input column vector x, a weight column vector w, we can express the output vector y in a graph structure.
Working with just the vectors, and using padding in the convolution we get conv(x, w) = [w3*x1 + w2*0 + w1*0,
w3*x2 + w2*x1 + w1*0,
w3*x3 + w2*x2 + w1*x1,
w3*x4 + w2*x3 + w1*x2,
w3*x5 + w2*x4 + w1*x3,
w3*0 + w2*x5 + w1*x4,
w3*0 + w2*0 + w1*x5]

Figure showing convolution in a graph structure.
Figure: the above convolution in a graph structure.

So, essentially the main two constraints are:

  1. The repeating structure of similar connections
  2. the same set of weights are used over all the connections.

There may also be two main approaches when trying to introduce convolution into a creature's neural structure:

  1. Try to engineer a way to insert the convolutional structure into a creature's genome.
  2. Allow it to happen naturally, and try to detect the convolutional structures to see if any creatures developed it.

Some problems with approach (1) are:

  • How do you mutate the weights?
  • Do you make the connections explicitly target multiple inputs and outputs?
  • What if a random mutation happens and the structure is modified and no longer a pure convolutional structure?

Some problems with approach (2) are:

  • How do you detect a convolutional structure?
  • How long will it take for such a structure to appear?
  • Will the structure be stable (i.e. not get changed such that it is no longer a convolutional structure)?

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.