Monotonic autotune support
Describe the new feature or enhancement
The simulator should support monotonic autotuning parameters for quantities of interest; this isn't about full model inversion, just simple tuning e.g. average firing rate via coupling strength. Tuning the time step via error estimate between 1st and 2nd order methods would also be welcome.
Describe your proposed implementation
This is an example for the MPR model
def tune_G(sim, target_r, verbose=False):
(_, y), = sim.run(simulation_length=1)
trips = 0
while y[:, 0, :, 0].mean() < target_r:
if verbose:
print(trips, sim.coupling.a, y[:, 0, :, 0].mean())
sim.coupling.a += 0.1
(_, y), = sim.run(simulation_length=1)
trips += 1
if verbose:
print(trips, sim.coupling.a, y[:, 0, :, 0].mean())
return sim
Describe possible alternatives
A more complete approach would invert the model but would be significantly more expensive to run.
Additional comments
Models become less identifiable outside critical regimes, so tuning scaling and noise with respect to measures of criticality or metastability should be widely applicable.
@maedoc I'm not sure I get exactly what you expect here as an end outcome, but I created a PR with a possible first step. https://github.com/the-virtual-brain/tvb-root/pull/748. Let me know what you think..