brian-team / brian2modelfitting

Model fitting toolbox for the Brian 2 simulator
https://brian2modelfitting.readthedocs.io
Other
14 stars 6 forks source link

[MRG] TraceFitter.refine with calculated gradient #29

Closed mstimberg closed 4 years ago

mstimberg commented 4 years ago

Based on discussions with @romainbrette, this PR implements the option for TraceFitter.refine to add equations to the model that perform local forward sensitivity analysis and can therefore be used to calculate the gradient of the error function (the basic approach is detailed in this notebook). This seems to work well and increases the speed of the convergence of the refine function. In our tests with real models, it sometimes failed with a division by zero which can be avoided by initializing the responsible variable (e.g. a gating variable) with a value different from zero.

The PR also adds support for standalone mode to refine and generate, and removes some general limitations of standalone mode (e.g. now it is possible to fit several different models in the same script).

I think this is ready to merge as it is, or do you still see anything that is missing from this feature @romainbrette ?