Git Product home page Git Product logo

alectrnn's Introduction

This is a Python 3 module designed to allow for a high level interface with neural network agents that play Atari games (via ALE). The Python API is divided into 3 main sections: the ALEExperiment class which allows high level setup of parameters for a complete run of ALE with some neural network and objective function (training is not a part of this module). handlers.py deals with the interface between the c++ code and python, and analysis_tools.py includes various plotting functions for displaying neuron state, parameter distribution, and other tools.

The c++ portion of the code follows the following structure: controller and player_agent classes define the interface of the agent with ALE. objective.cpp defines available objective functions. The neural networks are constructed via the NervousSystem which contains Layers, which in turn contains Integrators and Activators of various types, which define the structure of the network, its parameters, and neuronal dynamics. The Python NervousSystem handler defines the API for the lower level c++ code and allows construction of various types of neural networks. The user can create convolutional layers, recurrent layers, reservoir layers, all-to-all layers, and hybrid layers of the various types. For details about layer types, see the doc strings for the NervousSystem class in handlers.py or use help in the Python terminal.

Written for Python 3 using g++ 5.4. A C++14 compiler required.

Requirements: Numpy, ALE, CMake (for ALE)

Can be installed with pip. ALE (a modified forked version) and Numpy dependencies will be handled by pip. Can be installed using:

pip install --install-option="--prefix=$PREFIX_PATH" git+https://github.com/nathaniel-rodriguez/alectrnn.git

$PREFIX_PATH$ will specify the install location of the package (optional). Installing directly from the repo will require git to be installed as well (i.e. for the git+ command).

ALE supports a visual interface via SDL. If you want to install using the visual interface then you need to first install the libsdl1.2-dev library. By default SDL is not installed with ALE. It can be enabled via the --with-sdl option:

pip install --install-option="--with-sdl" git+https://github.com/nathaniel-rodriguez/alectrnn.git

This library is based on float (single precision values). If using with numpy, make sure to use dtype=float32 instead of the default float64.

Additional notes:

  • The --install-option="--lib-path=/path/to/ale-master" can allow compilation using a local download of the ALE source code.

  • To make animations from the analysis_tools module, ffmpeg needs to be installed for matplotlib to use.

  • The alectrnn_experiment_template.py requires evostrat to run. It can be installed from here: https://github.com/Nathaniel-Rodriguez/evostrat.git. See the template and python help command for examples and documentation.

alectrnn's People

Contributors

nathaniel-rodriguez avatar

Watchers

 avatar  avatar  avatar

alectrnn's Issues

Add multi-batch execution

Add a function like execute_async_batch that executes all batches in a list before closing the scheduler.

Fix RNN bug

The Eigen-based RNN integrator/layer combination has a bug where previous state is not carried on and the wrong equation is calculated.

Motor layer flexibility

Currently the motor layer is created automatically, preventing it from adopting a different activation function (in the case of spiking networks for instance) and preventing the adoption of say laterally-inhibiting motor layers.

Options: Add an override to motor layer in python NeuralSystem class.
Options: Currently all layers use same activation function, add override to select activation functions on a layer-by-layer basis.

Add network storage class

This object would injected in a batch and its call back executed to store the network. The object can then just be added to the storage section of the batch object.

Add soft-max to agent

We would need to add a soft-max function and RNG for the soft-max. This means also passing in a seed on agent creation.
Soft-max could be an option in agent-parameters
Soft-max would be applied to Neural net output and then the RNG would use the soft-max output to select an action for the agent.

implement load_experiment as a generator

The experiment, its results, and batch are loaded fully. This can be costly in terms if time and memory. If we implement the load to return a generator then experimental results and experiments can be pulled as they are used.

Add support for direct input into NN

Support running NN agents with numpy arrays from python and maintaining a log of the NN history. The whole time-series array of inputs would be provided to the agent and then ran. This may involve adding support in experiments and experiment managers for this capability for a given agent.

weight scale bug

During spike weight normalization the weights are shrunk rather than multiplied.

Add layers with lateral-inhibition

This can be added by expanding conv + recurrent layers, where a graph is made by default connecting neurons that are adjacent (via a grid) within a specific channel.

Fix layerwise initial guess

A little bug where the index of the first layer corresponds with 1 rather than 0 because the inputs are counted and as a result we need one initial buffer value to start. Can fix by just doing -1 on the layer indices so layer indices match the bound indices.

update async ga support

update the async_execute function to use arguments from the batch to configure the scheduler so that loopback and nanny's can be used.

Convert to new motor format

Add new 3-dim binary motor format. Make new agent that follows new format.
Re-evaluate this. It requires -1 to 1 activations which means non-spike and it means weights leading up to motor layer should be positive and negative (alternative might be 0-2.0 with 0.5-1.5 as center).

support batch file consolidation

Updated load_experiment function that uses consolidated results.
New load_experiment function that loads just a single batch result.
Update async batch function to consolidate following run.

Remove refractory period from IAF

Make the default IAF neurons have not refractory period. This can be added at a later date to a new neuron.
Adjust the IAF equations to properly handle time-scaling.

Support more general single run

current single runs are not agnostic to the type of optimizer, it tries to load from the optimizer. This is bad, just make one that takes parameters.

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.