A Python package for simulating recurrent, biologically-realistic neural networks
Switch branches/tags
Nothing to show
Clone or download
Latest commit aa06ad6 Sep 7, 2018



Anaconda-Server Badge Documentation Status Binder

linux windows coverage
Build Status Build status codecov

leabra7 is an implementation of the "Local, Error-driven and Associative, Biologically Realistic Algorithm" (LEABRA) in Python. It targets quantitative equivalence with the long-term support emergent71 branch of the Emergent project (note: this is not the current version of emergent).

Why is this interesting? Current neural network technology struggles with recurrence and focuses on global learning algorithms. The leabra algorithm allows simulation of neural networks with massive recurrence and local learning algorithms. Currently, we are using it explore interaction between the hippocampus and neocortex during memory recall (see the Princeton Computational Memory Lab for more details).

To get started, check out the documentation for an installation guide and tutorial.

Quick install


For users

Run the following commands to add the necessary conda channels:

$ conda config --append channels pytorch
$ conda config --append channels conda-forge

Now, you can install leabra7 with

$ conda install -c cdg4 leabra7

For developers

Gitter chat is here.

First, clone the repository. It can go anywhere, as long as you do not delete it after installation:

$ git clone https://github.com/cdgreenidge/leabra7.git

Run the following commands to add the necessary conda channels and create a virtual environment for development:

$ conda config --append channels pytorch
$ conda config --append channels conda-forge
$ conda env create -f scripts/environment.yml

This will create a new conda environment, named leabra7, and install the dependencies necessary for package development. Once it is created, activate it with

$ source activate leabra7

Install the leabra7 package in development mode:

$ conda-develop .

Now, run static analysis and tests to check that everything is working:

$ make

At this point, you can use leabra7 like a normal Python package. Changes made to the files will be reflected in the Python interpreter, as long as the package is reloaded or the interpreter is restarted.


See the "Projects" tab for more info.

For developers


  • "I hate code, and I want as little of it as possible in our product." – Jack Diederich
  • In general, follow the Khan Academy style guide.
  • Don't commit code that produces broken tests, or code that produces warnings during the build process. Disable warnings only if absolutely necessary. Think three times about committing untested code (in general, this should only be core simulation code that doesn't have clear outputs or properties.)
  • Read the Suckless philosophy and the Unix philosophy for inspiration.


Special thanks to Fabien Benureau for providing parts of the NXX1 implementation and net input scaling.