Skip to content

Library helping to incorporate biological constraints into Nengo networks

License

Notifications You must be signed in to change notification settings

astoeckel/nengo-bio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NengoBio Logo
PyPI version Build Status Coverage Status

NengoBio ‒ Biologically (more) plausible Nengo models

⚠ Warning: This project is work-in progress. Everything described here, including the name of the project and the API, is subject to change.

NengoBio is an add-on library for the Nengo spiking neural network simulator. Nengo is used by scientists to construct detailed models of neurobiological systems. However, Nengo and, to some degree, the underlying Neural Engineering Framework, have restrictions that limit the biological plausibility of the created networks. NengoBio lifts some of these restrictions by implementing the following:

  • Dale's Principle (:ballot_box_with_check: Fully implemented)
    While it is possible to work around this limitation, Nengo usually does not explicitly mark neurons as excitatory or inhibitory. This means that a single pre-neuron can connect to post-neurons both excitatorily and inhibitorily, depending on the sign of the weights computed by of the weight solver. NengoBio marks neurons as either excitatory or inhibitory and accounts for this while solving for connection weights.
  • Bias current elimination (:ballot_box_with_check: Fully implemented)
    The Neural Engineering Framework assumes that each neuron is connected to a constant bias current source. This bias current is used to diversify the avilable neuron tuning curves, yet is a little unrealistic from a biological perspective. NengoBio eliminates the bias current by solving for synaptic weights in current space, effectively decoding the bias current from the pre-population state.
  • Support for dendritic computation (:ballot_box_with_check: Fully implemented)
    Dendritic nonlinearities play a key role in information processing in central nervous systems and can be systematically exploited to perfrom nonlinear, multivariate computations. NengoBio adds support for dendritic computation to Nengo by allowing an arbitrary number of neuron ensembles as pre-objects in a connection.
  • Support for conductance-based synapses as well as neurons with arbitrary passive dendritic trees (Planned) Dendritic computation relies on nonlinear effects in the dendritic tree and the specific tree topology. NengoBio adds support for arbitrary passive multicompartment neuron models to Nengo.

Installing NengoBio

Dependencies: NengoBio requires Python 3 and depends on numpy>=1.16.3, scipy>=1.2.0, cvxopt>=1.2.2, nengo>=3.0.0.dev0.

Clone this repository by running

git clone https://github.com/astoeckel/nengo_bio

You can then install the package by running the following inside the nengo_bio repository

pip3 install -e .

This will automatically install all dependencies. Note that NengoBio currently requires the most recent development version of Nengo, which has to be installed separately.

Using NengoBio

Assuming that you know how to use Nengo, using NengoBio should be quite simple. Just add the following to your list of imports

import nengo_bio as bio

and replace nengo.Ensemble with bio.Ensemble and nengo.Connection with bio.Connection where applicable.

The bio.Ensemble class

The bio.Ensemble class acts like a normal Nengo ensemble but has two additional parameters: p_exc and p_inh. These parameters describe the relative number of excitatory/inhibitory neurons in the population. Note that p_exc and p_inh have to sum to one. These parameters are only relevant if an ensemble is a pre-object.

Note: Neurons will be assigned a synapse type at build time. If any of p_exc or p_inh is set, each neuron will either be excitatory or inhibitory. Without p_exc and p_inh, the ensemble will behave just like a normal Nengo ensemble.

Warning: bio.Ensemble can be used in conjunction with the normal nengo.Connection class. The excitatory/inhibitory nature of the neurons in a bio.Ensemble will only be taken into account when using bio.Connection (see below).

Examples

Examples 1: An ensemble exclusively consisting of excitatory neurons

ens_exc = bio.Ensemble(n_neurons=101, dimensions=1, p_exc=1.0)

Examples 2: An ensemble exclusively consisting of inhibitory neurons

ens_inh = bio.Ensemble(n_neurons=101, dimensions=1, p_inh=1.0)

Examples 3: An ensemble consisting of 80% excitatory and 20% inhibitory neurons (both lines are equivalent):

ens_mix = bio.Ensemble(n_neurons=101, dimensions=1, p_exc=0.8)
ens_mix = bio.Ensemble(n_neurons=101, dimensions=1, p_inh=0.2)

The bio.Connection class

A bio.Connection connection connects n-pre ensembles to a single target ensemble. Per default, it will automatically account for the excitatoriness/inhibitoriness of the pre-neuron population.

Notable Parameters

  • pre: This can be either a single pre-population or a tuple of pre-populations. The dimensions of the values represented by the pre-populations will be stacked.

  • bias_mode (default bio.Decode): If set to bio.Decode, the post-neuron bias current will be decoded from the pre-population instead of being assumed to be an intrinsic property of each neuron. In constrast, a value of bio.JBias will disable bias current decoding altogether (this is the default Nengo behaviour). A value of bio.ExcJBias will only decode inhibitory biases (excitatory biases are assumed to be an intrinsic part of the neuron ensemble), a value of bio.InhJBias will decode excitatory biases (inhibitory biases are an intrinsic part of the neuron ensemble).
    Note: If multiple connection objects target the same post-object (not recommended, try to use a single connection per post-object in your network), make sure set this to bio.JBias for any but the first bio.connection targeting the same post population.

  • solver (default QPSolver()): an ExtendedSolver instance from nengo_bio.solvers. ExtendedSolvers can solve for currents and take neuron parameters into account.

Examples

Example 1: Simple communication channel between ens_a and ens_b taking neuron/synapse types into account and decoding the bias current:

bio.Connection(ens_a, ens_b)

Example 2: 2D communication channel where ens_a, ens_b represent a one-dimensional value and ens_c represents a two-dimensional value.

bio.Connection((ens_a, ens_b), ens_c)

Example 3: Linear "Dendritic Computation"

bio.Connection((ens_a, ens_b), ens_c, function=lambda x: np.mean(x))

Citing

The techniques used in this library are described in more detail in this arXiv preprint: https://arxiv.org/abs/1904.11713. We would appreciate it if you could cite this paper in case you use this library in a published model.

@misc{stoeckel2019passive,
    author = {Andreas Stöckel and Chris Eliasmith},
    title = {Passive nonlinear dendritic interactions as a general computational resource in functional spiking neural networks},
    year = {2019},
    eprint = {arXiv:1904.11713},
}

License

nengo_bio -- Extensions to Nengo for more biological plausibility
Copyright (C) 2019  Andreas Stöckel

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

About

Library helping to incorporate biological constraints into Nengo networks

Resources

License

Stars

Watchers

Forks

Packages

No packages published