SpineML / SpineML_2_BRAHMS

Code generation scripts to run a SpineML neural model using BRAHMS on standard CPUs
http://spineml.github.io/simulators/BRAHMS/
4 stars 3 forks source link

Batch XML format proposal #18

Open ajc158 opened 9 years ago

ajc158 commented 9 years ago

I am putting this here for posterity.

I think that we need another layer in SpineML for describing Batch operations on Experiments. This layer would be structured similarly to a Component, as a dynamical system of experiments which uses the a set of pre-defined values or the experimental logs to determine what experiment to call next and how to parameterise it. Here are two examples:

  1. simple batch with parameter range: Go through the parameters and apply them in turn to a single experiment...
<SpineML>
  <Batch initial_experiment="expt1">
    <RunExperiment name="expt1" url="experiment1.xml">
      <SetProperty ref="prop1">
        <Range start="1" end="2" step="+0.1"/> <!-- Built-in - but could be extensible in later versions -->
        <!--  Nested SetProperty means 'for each of the outer properties' -->
        <SetProperty ref="prop2">
           ...
        </SetProperty>
      </SetProperty>
    </RunExperiment>
  </Batch>
</SpineML
  1. parameter search: Try and minimise some value by searching through a parameter space... analyse the results once all of them are in
<SpineML>
  <Batch initial_experiment="expt1">
    <RunExperiment name="expt1" url="experiment1.xml">
      <SetProperty ref="prop1">
        <FromInput initial_value=0.2/>
      </SetProperty>
      <SetProperty ref="prop2">
        <FromInput initial_value=0.4/>
      </SetProperty>
      <Condition url="analyse1.py">
        <Input name="in1">
          <!--OLDLogRef run_name="current()" target="Pop1" port="V" indices="1-3" time="2-200"/-->
          <LogRef run_name="current()" target="output_name_a"/>
        </Input>
        <If value="True">
          <TriggerRunExperiment name="expt1">
            <Connect src="value0" dst="prop1"/>
          </TriggerRunExperiment>
        </If>
        <If value="False">
          <GotoEnd/>
        </If>
      </Condition>
    </RunExperiment>
    <End>
      <Analyse>
        <Input name="in1">
          <!--OLDLogRef run_name="batch()" target="Pop1" port="V" indices="all" time="2"/-->
          <LogRef run_name="batch()" target="output_name_1"/>
        </Input>
        <Input name="in2">
          <!--OLDLogRef run_name="current()" target="Pop2" port="V" indices="1-3" time="2-200"/-->
          <LogRef run_name="current()" target="output_name_2"/>
        </Input>
        <Output name="MyNewAnalysisLog"/>
      </Analyse>
    </End>
  </Batch>
</SpineML
ajc158 commented 9 years ago

Further thoughts. The indices and time should not be set in the batch XML, but in the experiment. This makes the GUI simpler and unambiguous, and the XML simpler. This would mean that the scripts and experiments could be seen as having 'ports' which could be joined up to create the entire batch system...

Additionally, rather than target a pop and port, the LogRef should refer to a log output from the model... I've applied these changes above and highlighted the old way of writing