There’s some discussion going on about specifying systems using LightGraphs here.

Hi,

I’ve done this before as a coding exercise. You could use DiffEqFlux to get gradients of the model wrt some loss function. Or, more simply, any of the techniques here.

DiffEqParamEstim.jl is also a nice package for this.

One tip: don’t use an L2 loss on your data. A slight phase lag in a spike results in a huge L2 difference vs the nominal spike. So the loss function is badly conditioned, and optimisers converge more slowly.

A well conditioned loss for spiking models is: calculate the current you would have to inject at any point in time to make \dot{V}(t) of the parameterised model the same as that of the nominal model. IE

I_{inj}(t) = \dot{V}(t) - \dot{V}^*(t)

Then take the l2 integral of this current:

Cost = \int^T_0 I_{inj}(t)^2 \ dt

IE how hard would I have to push charge in/out of the membrane to make the model dynamics match the nominal dynamics.

Scientifically speaking, it might be useful to make your model behave like the data. However I don’t think there is any point in trying to infer biophysical parameters (e.g. conductances) by model fitting. It’s a hugely ill-coniditioned problem on these conductance based models. You give me a model and a set of parameters that fit the data. I will give you a completely (orders of magnitude) different set of parameters that also fit the data. Hence, the parameter values themselves are meaningless (although the capability of the model to fit the data may be meaningful). (This might be a bit of a generalisation)

Good luck!

PS another nice feature of the I_{inj} loss I described:

If the only parameters you are interested in are maximal conductances (or more generally, parameters that enter the equation for \dot{V} but not the time-derivatives of the ion channel states)…

Then you don’t even need to solve the differential equation more than once to calculate the loss at different parameter values! Since if you injected the I_{inj}(t) current, voltage (and hence ion channel) dynamics would be the same as for the nominal model.

So you can

- Solve the ion channel dynamics corresponding to your observed voltage trace (i.e. solve a differential equation).
- Trapezoidally integrate I_{inj}(t)^2 over time, using

I_{inj}(t) = \dot{V}^*(t) - \dot{V}(parameters, t)

and the fact that \dot{V}(parameters,t) + I_{inj}(t) follows the (solved) dynamics of V^*(t) over time.

Of course, this needs accurate knowledge of \dot{V}^*(t)…

We recently released a SNN sim package as well, WaspNet.jl. Although it doesn’t integrate with DifferentialEquations currently