Synaptic weights optimisation with brian2modelfitting

65 views
Skip to first unread message

filippo....@gmail.com

unread,
Jun 24, 2020, 5:46:47 PM6/24/20
to Brian
Hi, 

I am in the process of converting a rate-based model of the insects' Central Complex to a spiking model.
For the neuron model I am using LIF neurons as described in the documentation 
eqs = '''
      dVm/dt  = ((El - Vm) + I_syn) / taum : volt
      I_syn = ge - gi : volt
      dge/dt = -ge/taue : volt
      dgi/dt = -gi/taui : volt
      '''
threshold_eqs = 'Vm >= Vt'
reset_eqs = 'Vm = Vr'

I have several neuron groups connected by either excitatory or inhibitory synapses according to 
synapses_model = '''w : 1'''
synapses_eqs_ex = '''ge += we * w'''
synapses_eqs_in = '''gi += wi * w'''
ex_synapses = Synapses(G_source, G_target, model=synapses_model, on_pre=synapses_eqs_ex)
in_synapses = Synapses(G_source, G_target, model=synapses_model, on_pre=synapses_eqs_in)

Many of the parameters (El, taum, Vt, Vr and the different weights w for synaptic connections) come from electrophysiology recordings and they have to stay fixed. 
I also have recorded spikes rates for the inputs and the different neural populations. 

Let's say I have a PoissonGroup connected to NeuronGroup A which is connected with excitatory synapses to NeuronGroup B. 
The rates of the PoissonGroup are defined as a function of time using a TimedArray as described in the documentation.

I have the expected rates for A and for B given the inputs encoded by the PoissonGroup. 

Can the brian2modelfitting library be used to optimise the ge, taue, we and gi, taui, wi parameters so to match the spiking rates?
In case do you know of any alternative ways to achieve this? 

Thank you! 

Marcel Stimberg

unread,
Jun 25, 2020, 1:27:39 PM6/25/20
to brians...@googlegroups.com
Hi Filippo,

the brian2modelfitting toolbox does not support networks, you can only
use it to fit single neurons (for e.g. voltage- or current-clamp
recordings). In principle, you can use the same approach for a network,
but you need to do the interface with an optimization library (e.g.
scipy's leastsq fitting, or an optimization library like Nevergrad)
yourself. The basic structure would be something like

# Set up model and spike monitor
store()  # more efficient than recreating the model from scratch each time
def run_simulation(parameters):
    restore()
    # set the parameters
    run(..)
    return (spike_mon.count - expected_counts)**2  # return error

# call the optimization function with run_simulation as argument

Hope that gives you same idea.

Another option would be of course to do some more brute-force grid
search and see where the parameters best fit what you expect.

Best,

  Marcel


Filippo Ferrari

unread,
Jun 25, 2020, 5:15:36 PM6/25/20
to Brian
Hi Marcel, 

Thank you very much!

Artemio Soto

unread,
Jul 21, 2021, 3:10:02 AM7/21/21
to Brian
Hi Marcel,

Is there any working example of model fitting a network? I have a network of 2 populations of LIF neurons, i.e. a pyramidal population and an inhibitory inter-neuron population. I am struggling to implement your solution, mainly because I am very new to using Brian2.

Thank you,

Artemio

Artemio Soto

unread,
Jul 21, 2021, 3:11:50 AM7/21/21
to Brian
Could you solve it in the end Filippo? I am stuck in a similar problem as you.

Regards.

Filippo Ferrari

unread,
Jul 21, 2021, 8:51:37 AM7/21/21
to Brian
Hi, 
I followed Marcel's pseudocode, first I optimised the first population on its own. 
Once I found a decent set of parameters I moved onto the next one (mine was a feedforward network so it was easy to split the optimisation process in "layers"). 

Hope this helps!
Filippo 
Reply all
Reply to author
Forward
0 new messages