https://github.com/michaelmelanson/spiking-neural-net
A spiking neural network simulation library
https://github.com/michaelmelanson/spiking-neural-net
neural-network neural-networks neurons rust rust-library science
Last synced: 4 months ago
JSON representation
A spiking neural network simulation library
- Host: GitHub
- URL: https://github.com/michaelmelanson/spiking-neural-net
- Owner: michaelmelanson
- License: gpl-3.0
- Created: 2017-12-09T19:39:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T03:56:57.000Z (about 2 years ago)
- Last Synced: 2025-01-11T05:18:23.088Z (4 months ago)
- Topics: neural-network, neural-networks, neurons, rust, rust-library, science
- Language: Rust
- Size: 4.32 MB
- Stars: 23
- Watchers: 2
- Forks: 2
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust-list - michaelmelanson/spiking-neural-net - neural-net?style=social"/> : A spiking neural network simulation library. (Machine Learning)
- awesome-rust-list - michaelmelanson/spiking-neural-net - neural-net?style=social"/> : A spiking neural network simulation library. (Machine Learning)
README
# spiking-neural-net [](https://travis-ci.org/michaelmelanson/spiking-neural-net)
A spiking neural network simulation library.## Usage
You will need a Rust development environment, which you can install by visiting https://rustup.rs/ and following the instructions.
Once you have Rust and Cargo installed, you can run a simulation with:
make
You should see output like this:

This will produce plot images called `neuron-trace.png` and `spikes.png` like the ones below.
Note that you can also build the debug version by omitting the `--release` flag, but it will run slowly. This is good if you want to use a debugger, but if you want to simulate any reasonably large networks in real-time you will need to use release mode.
## Sample output
It should create output images like this:
Filename | Image
--------------|-----------
`neuron-trace.png` |  This shows the activity of a single neuron. Each of the vertical lines is an action potential, shown as a white dot on the plots below. There's a noise floor representing random thalamic input.
`spikes.png` |  You'll need to download this image and zoom in to see the activity.
`spikes.png` (cropped) | .png) This represents about 1s of time across 1100 neurons.The `spikes.png` image shows some fascinating results:
* In the cropped photo you can see vertical lines of dots. This shows that all the neurons in the network have synchronized and are pulsing together at about 12Hz. This is a similar rate to Alpha waves in mammalian brains.
* Also in the cropped photo can also see horizontal lines. This is the motor layer of each column; this layer currently is weakly connected and doesn't synchronize with the rest of the neurons.
* In the full `spikes.png` image there are three distinct phases:
* **0s-4s:** The network quickly settles into a 5Hz rhythm, similar to Theta waves. I believe this is when the columns are organizing themselves.
* **4s-10s:** The network becomes disorganized. I believe this is when the columns are learning to wire together and are trying to sort out their connections.
* **10s+:** The network becomes synchronized at a much faster 12Hz rhythm.
## About the simulationThis library simulates networks of biologically-inspired neurons. Spiking neural models are implemented as ordinary differential equations integrated using Euler integration at 1 millisecond resolution.
The simuation is written in the Rust programming language and uses [Specs](https://github.com/slide-rs/specs), an Entity-Component-System framework with excellent parallelization and performance. This allows it to simulate simulate about 1800 neurons and 100k synapses, including an online learning algorithm, in real-time on a typical laptop.
## Features
### Neural models
- [x] Izhikevich neurons
* Model: https://www.izhikevich.org/publications/spikes.htm
* Code: https://github.com/michaelmelanson/spiking-neural-net/blob/master/src/simulation/models/izhikevich.rs
- [x] Hindmarsh-Rose neurons
* Model: https://en.wikipedia.org/wiki/Hindmarsh%E2%80%93Rose_model
* Code: https://github.com/michaelmelanson/spiking-neural-net/blob/master/src/simulation/models/hindmarsh_rose.rs### Learning models
- [x] Spike-timing dependent plasticity
* Code: https://github.com/michaelmelanson/spiking-neural-net/blob/master/src/simulation/learning/stdp.rs### Network organization
- [x] Columnar organization
* Networks are organized into 100-neuron columns composed of five layers (motor, sensory, afferent, efferent, internal)
* Code: https://github.com/michaelmelanson/spiking-neural-net/blob/master/src/simulation/mod.rs#L70-L160## TODO
- [ ] Multiple morphologies. Currently all neurons are Izhikevich 'regular spiking' neurons.
- [ ] Configuration. Currently you need to change the source code to change the network design or neural model parameters.