hetero¶
hetero simulates recurrent neural networks whose neurons are heterogeneous
in their time constants, benchmarks them on a family of temporal tasks, and
quantifies how much of the task performance is explained by heterogeneity.
Warning
This package is created for the research purposes only. No backward compatibility in API or documentation is guaranteed. Use with caution.
Note
If you use this package please cite the following article:
Golmohammadi, A., Luboeinski, J. & Tetzlaff, C. Robust and efficient enriched representation with intrinsic neuronal heterogeneity. Preprint at https://doi.org/10.48550/arXiv.2412.05126 (2025).
Installation¶
pip install -e .
pip install -e ".[docs]" # to build these pages
See Detailed Installation for more info.
Quick start¶
# a 250-neuron rate network on a chaotic Lorenz input
hetero --stim lorenz --N 250 --task tayloramus --dyn LI
# a spiking network with a temporal-resolution readout
hetero --stim lorenz --N 250 --task tayloramus --dyn LIF \
--readout_activation d10
# sweep first, plot once at the end
hetero --stim lorenz --noviz
hetero --stim lorenz --replot
Run hetero --help for the full flag list; the flags are grouped as input
and output, heterogeneity, network, dynamics, stimulation, task, readout,
optimization, dataset, and uncertainty quantification. Every flag defaults to
the matching key of hetero.config.CFG.
How a run is put together¶
Everything is driven from a single command line entry point, hetero
(hetero.cli.main()), which builds a parameter tree from the defaults in
hetero.config.CFG and hands it to
hetero.sim.Simulation.
Stimulus –
hetero.stimulusdispatches the--stimlabel to one of the generators inhetero.stims.processes,hetero.stims.mapsorhetero.stims.elementary, and concatenates the requested timeseries into the inputu.Network –
hetero.networkssamples the sparse topology and the excitatory/inhibitory weights.Heterogeneity –
hetero.utils.sample_taus()draws one neuronal time constant per neuron;hetero.utils.make_net_ids()enumerates the(n, h)grid of mean-timescale levelsnand heterogeneity levelshthat the run sweeps.Task –
hetero.tasksdefinesTaylor(Taylor expansion of the input),Nostradamus(a shifted version of it) andTayloramus(both at once), each flattened into(dim, delta, deg)subtasks.Dynamics –
hetero.dynamics.liintegrates rate networks withscipy,hetero.dynamics.lifintegrates spiking networks withbrian2.Readout and score –
hetero.fitting.Decoderfits a linear readout on the train split and scores it on the held-out split, over several trials and network realizations for uncertainty estimates.Figures –
hetero.vizrenders the connectivity, the time-constant distribution, theu/v/xtraces, the score maps, and the angle/effective-rank summaries.
Contents¶
Detailed installation
Command line
API