multi-scale differentiable brain modeling workflow utilizing BrainPy, a unique differentiable brain simulator that combines accurate brain simulation with powerful gradient-based optimization.
Here, we illustrate to implement a differentiable approach for multi-scale brain modeling. See our paper for more details:
In general, several Python packages related to the brainpy ecosystem are required to run the code:
We provide a simple example to illustrate the differentiable neuron fitting process.
- To fit the GIF model based on the membrane potential or spike trains, run the following command:
python neuron_fitting_of_gif_model.py
- To fit the HH model based on the membrane potential or spike trains, run the following command:
python neuron_fitting_of_hh_model.py
We provide a simple example to illustrate the training process of conductance-based EI spiking networks based on the cognitive task of Evidence Accumulation.
The following arguments are used to control the model configuration and training:
--conn_method
: The method to generate the connection matrix. It can bedense
(dense connection),gaussian
(sparse connection), orrand
(random and sparse connection).--n_rec
: The number of recurrent neurons. Then, the excitatory and inhibitory neurons are divided by a 4:1 ratio.--w_ei_ratio
: The E/I weight ratio.--mode
: It can betrain
(train the network) orsim
(simulate the network).--method
: The training method. Can bebptt
(back-propagation through time) orexpsm_diag
ordiag
(if brainscale is available).
For example, to train a conductance-based EI spiking network, run the following command:
# Training with BPTT
python task-coba-ei-rsnn.py --method bptt
# Training with online learning methods in BrainScale
python task-coba-ei-rsnn.py --method diag
python task-coba-ei-rsnn.py --method expsm_diag --etrace_decay 0.98