Skip to main content

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 (☑️ 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 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 (☑️ 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 (☑️ 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

📝 See the example notebook

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. It will automatically account for the synapse type assigned to each neuron.

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.

  • decode_bias (default True): if True the post-neuron bias current will be decoded from the pre-population instead of being assumed constant. Set this to False 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/>.

Metadata

Release files for nengo-bio 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nengo-bio 0.2.0
File Size Uploaded Provenance Actions
nengo_bio-0.2.0.tar.gz 37.9 kB Without provenance Details for nengo_bio-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nengo-bio 0.2.0
File Interpreter ABI Platform Actions
nengo_bio-0.2.0-py3-none-any.whl Python 3 none any Details for nengo_bio-0.2.0-py3-none-any.whl

Total release size: 101.7 kB

Release files / nengo_bio-0.2.0.tar.gz

Download URL nengo_bio-0.2.0.tar.gz
Size 37.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1208a8c119f108faed97acba743713215c987bc50172a7c0e75742e494b7d766
BLAKE2b-256 checksum
How to use checksums
dd3fa0b6068209307814ce743d3f710d45045a781341040bf0bfc0f03a7708ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.3

Release files / nengo_bio-0.2.0-py3-none-any.whl

Download URL nengo_bio-0.2.0-py3-none-any.whl
Size 63.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d05c7887e463d00b7c1bc6bb0212ef03b367952d1cdc106ce40e5bb14b0e21cc
BLAKE2b-256 checksum
How to use checksums
05747149aa0fbb5b4cdba67bd1f91c440036408e2d530010536a77be9442a8f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.3

Security for nengo-bio 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page