NeuroML / NeuroML2

This repository hosts the NeuroML 2 Schema, the ComponentType definitions in LEMS and the core documentation of NeuroML2.
https://docs.neuroml.org
GNU Lesser General Public License v3.0
51 stars 24 forks source link

Call for ideas: how should we implement model optimization/parameter exports in NeuroML model definitions? #176

Open llandsmeer opened 3 years ago

llandsmeer commented 3 years ago

Hi, as a computational neuroscientist I'm working on tuning neuron models to behave in desired ways and as a developer I'm currently working on building a GPU backend for EDEN the simulator. I thought it would be nice to combine both and build a API for EDEN which would make it easy too write model tuners like evolutionary algorithm's against EDEN without having to reload the entire NeuroML file each step.

So in short, a model optimization would start with loading of the entire NeuroML model. Then a loop would start where we evaluate the fitness of one or more cells, and change their parameters to tune them to the correct behaviour. That's currently very expensive in EDEN and probably all NeuroML based simulators as we have to reload the entire model each step of the loop. It would be nice if we could mark some parameters for export and/or optimization in the NeuroML file itself.

So something like this:

<iafCell id="iaf"
         leakConductance="0.2nS"
         leakReversal="-70mV"
         thresh="-55mV"
         reset="-70mV"
         C="3.2pF"
         optimizationTarget="thresh"
         optimizationMin="-60mV"
         optimizationMax="-40mV"
         />

Or maybe some definitions at the toplevel:

<optimizationTarget cell="iaf" param="thresh" min="-60mV" max="-40mV"/>

Or don't make this about optimization but just name the parameter for export, which would make the intended application less clear but allows for more freedom (e.g. other uses).

<optimizationTarget cell="iaf" param="thresh" />

Or of course it's also a possibility to not make any of this part of neuroml and force simulator-specific solutions. And the philosophical question whether the optimization is part of the model specification (and should be reproducible by other researchers) or that NeuroML models should solely be inputs and outputs of such algorithms.

This is just a discussion starter - maybe there already exist some ideas how to implement this maybe someone even added this a a simulator but it's not standardized yet. Looking forward to your thoughts and ideas!

Kind regards, Lennart Landsmeer

llandsmeer commented 3 years ago

Could for example also be relevant for people doing research on certain parameter sweeps of their models

sanjayankur31 commented 3 years ago

CC'd members of the editorial board. @pgleeson : could we add Andrew and Salvador to the org too so we can cc them too? (or do we have a team neuroml/editors or something that can be used for this?)

pgleeson commented 3 years ago

@llandsmeer Thanks for asking. This is quite related to the model tuning capabilities of https://github.com/NeuralEnsemble/neurotune, which have been added to pyneuroml here: https://github.com/NeuroML/pyNeuroML/tree/master/pyneuroml/tune

See for example this script which has most of what you want: loading a NeuroML model; specifying the max/min in terms of NeuroML parameters; saying what the behaviour to tune against is, and specifying which simulator to use.

I'd test that out before going too much further. EDEN will be added as an execution option to pyneuroml soon (pynml MyLEMS.xml -eden) but it may be better to extend NeuroMLSimulation.py as EDENSimulator.py and work with EDEN simulations more directly. The method here could be updated to keep the NeuroML model in memory somehow, and just adjust the parameter(s) required and rerun the simulation. However, you would have to work around the generation of code for optimized execution (which might have to be regenerated every time the parameters in a channel say change).