Skip to content

Conversation

@maedoc
Copy link
Member

@maedoc maedoc commented Mar 21, 2025

This is a another take on hybrid models, where multiple models are used at once, which is a more array oriented than #739 and closer to TVB style with traits etc. It introduces the following elements to the TVB datatypes (naming suggestions welcome)

  • subnetwork: compromises a set of nodes + neural mass model + scheme + monitors
  • projection: connects a cvar from a source subnet to a cvar in a target subnet
  • networkset: collects subnetworks and projections into a coherent whole where we can
    • compute the coupling across all projections
    • compute all dfuns
    • apply an integration scheme to all dfuns to take a step in time

From there, it turns out that flexible state shapes creates surprise in many places, where it's assumed that the state variables are homogenous across nodes. For instance, the integrator noise is set per state variable, however in different models, these need to be set with different values.

Other major nuances are related to monitors, but I think some straightforward compromises are available: for "debug" monitors like raw or temporal average, the monitor will be applied per model to produce a per-subnetwork trace. Monitors more "neuroimaging" like will choose a particular state variable and apply the forward model (gain matrix, BOLD equations) to it.

Stimulation is another open question, but I wonder if, deparating from the monolithic style, a stimulus cannot just be a "subnetwork" with a projection to the nodes being stimulated? Ideas welcome.

Performance is terrible w/ ~5-10k iter/s on default connectome w/ two models, but this is expected w/ the naive implementation and will improve dramatically after massaging for jax or a c++ impl.

@i-Zaak @ReyJ94 feedback welcome!

implementation status

  • all monitors work
  • all integrators work
  • time delays implemented
  • source/target cvars are arrays not scales
  • make it faster
  • subnetwork can have internal projection(s)
  • apis are documented
  • stimulation is supported
  • afferent coupling monitors (fix tests)
  • add tests against existing simulation scenarios

@maedoc maedoc self-assigned this Mar 21, 2025
@maedoc
Copy link
Member Author

maedoc commented Mar 21, 2025

(btw, this scratches the multiple-connectome itch, as well, since multiple projections can be configured with different connectomes, and will be summed to the same cvar)

@i-Zaak
Copy link
Contributor

i-Zaak commented Apr 7, 2025

Hey there, cool stuff, sorry for the latency. I really like the direction of generalizing the simulator in terms of heterogeneity of the system, and I agree with the arrays and traits as basic building blocks.

If I understand this correctly, currently the system is defined as a singular network (connectivity), with global IDs over nodes, and a set of non-overlapping masks assigning nodes to models which govern the local dynamics. The states of the system is then a tuple of arrays of states for individual subnetworks.

I think that the global indexing is a necessary choice on the level of the projections, but don't see a reason for the individual subnetworks to make use of the mask. I'd have the tendency to separate the intra- and inter- subnetwork connectivity (domain might be a an alterantive term to consider), as I can imagine reuse of defined subnetworks across applications (e.g. always the same model for a certain subcortical structure with a given internal connectivity), while swapping out the rest (e.g. changing the model and connectivity for the cortex).

What the networkset then should do to get the total coupling is:

  • evaluate each of the intra-subnetwork coupling
  • evaluate each of the inter-subnetwork coupling
  • dfuns, step, monitors

I'd happily help to work through the surprises along the way.

@maedoc maedoc changed the title another take on hybrid models Add support for hybrid model Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants