Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving spDCM tutorial #500

Merged
merged 63 commits into from
Jan 3, 2025
Merged

Improving spDCM tutorial #500

merged 63 commits into from
Jan 3, 2025

Conversation

david-hofmann
Copy link
Member

WIP PR to improve the spDCM tutorial

david-hofmann and others added 30 commits November 13, 2024 20:37
* switched from symbolic arrays to list of symbolic parameters. Needed to be able to set tunable flag for individual parameters of the array. Added untune! utility function to set tunable flag to false on list elements.

* added new approach to set tunable flag for the connection matrix also to the tutorial

* use generate_weight_param also in StimulusBlox and ObserverBlox connectors and set standard connection weight to non-tunable

* fixed and cleaned code

* minor changes

* update MTK compat

* added Project.toml to test

* fixed MTK compat once more

* added more packages to test environment needed in GraphDynamics tests

* remove test deps and unnecessary deps

* add Test to tect project

* remove Test dep from main Project

* add missing test deps

* add Statistics dep

* removed [extras] from Project.toml

* added [extras] again.

---------

Co-authored-by: haris organtzidis <[email protected]>
* add decision makign example

* wrap in a function
…494)

* Fix warning

* set PING jcn to zero

* Removing jcn(t)=0 from another neural mass

---------

Co-authored-by: Mason Protter <[email protected]>
added description to README.md
* Update Project.toml

* Update Project.toml

* fix initial conditions for discrete jcns
* fix `win_size` when using `transient` ≠ 0
* update scripts and tests using `mean_firing_rate`
* remove `mean_firing_rate` function
* add a `firing_rate` dispatch for `EnsembleSolution`
* change in a comment for consistency
* address Scott’s feedback on the basal ganglia tutorial
* change voltage plotting method
- add `powerspectrumplot` methods for plotting precomputed power spectrums
- change normalization (dB)
- automatic calculation of limits and band labels positions
- update tutorials
* change all dispatches of `BloxConnector` to `Connector`

* export `Connector` and related convenience functions

* update all `<: CompositeBlox` to use `Connector`

* move PING neuron dispatches to `/src/blox/connections.jl`

* add `AdjacencyMatrix` constructors for `Connector`

* add `connectors_from_graph, returns `Vector{Connector}`

* update `connector_from_graph`

* update all `system_from_graph` utility functions

* update getter functions

* update graphs tests

* add `NoLearningRule`

* move `connect_action_selection!` dispatches to `src/blox/RL`

* cleanup old commented block

* include PING neurons before connections
* use `Vector{Vector}` and `Dict` in `Connector` fields to keep track of individual connections

* import `MTK.equations`

* improve `show` for `Connector`

* add getter functions for all `Connector` fields

* add `Vector{Vector}` wrapper function

* remove old `BloxConnector` getter functions

* change local variable name to not clash with getter function name

* add `equations(Connector)` argument to discrete callback generators to avoid accumulating them again

* adapt `AdjacencyMatrix` to new `Connector` field types
…#504)

* use `AdjacencyMatrix` instead of `get_adjacency`

* store `Vector{Connector}` in composite bloxs without reducing

* change `Vector{Vector}` to `Vector` for all `Connector` fields

* adapt system construction to new `Connector` fields

* `get_connector` always returns `Vector{Connector}`

* accumulate connection eqs per blox like `BloxConnector` used to

* adapt RL to new `Connector`

* fix show Connector

* fix RL test

* change adjacency colormap to grays

* add `get_connector`(s) util functions

* use correct connectors getter

* add token weight for Striatum=>Striatum connection

* use correct connectors getter
* reexport t and D from MTK

* add alias for `AbstractNeuronBlox` for brevity

* export functions for easier custom blox+connector definitions

* add generic spike affect and restructure existing one for LIF neurons

* add `system(blox)` to return (simplified) system

* option to choose between namespaced or not input equations in getter function

* add generic Connector dispatch

* add getter functions for spike affect states and params

* remove abstract neuron -> neuron Connector dispatch

* change values in `spike_affects` to `Vector{Tuple}` instead of `Tuple{Vector,Vector}`

* move functional spike affect to `Neurographs.jl`

* add generic fallback for discrete callbacks

* fix typo

* add `weight` argument to `connection_spike_affects`
* reexport t and D from MTK

* add alias for `AbstractNeuronBlox` for brevity

* export functions for easier custom blox+connector definitions

* add generic spike affect and restructure existing one for LIF neurons

* add `system(blox)` to return (simplified) system

* option to choose between namespaced or not input equations in getter function

* add generic Connector dispatch

* add getter functions for spike affect states and params

* remove abstract neuron -> neuron Connector dispatch

* change values in `spike_affects` to `Vector{Tuple}` instead of `Tuple{Vector,Vector}`

* move functional spike affect to `Neurographs.jl`

* add generic fallback for discrete callbacks

* fix typo

* add `weight` argument to `connection_spike_affects`

* import & export `outputs`

* extend `MTK.outputs` util fuction

* remove `output, jcn, voltage` fields, only keep metadata

* apply `outputs` function instead of field access

* rename `odesystem` field to `system`

* wrap `outputs` in `Num`

* capitalize voltage state `V`

* capitalize all occurences of `v` state

* actually capitalize all `v`

* try fixing the GD `output` error

* actually try fixing the GD test

* add `namespaced` kwarg for `outputs`

* fix output tag in PING neurons

* default to `namespaced=false` for shorter `outputs` return

* also expand equations, inputs, unknowns, parameters from MTK to work with blox

* use namespaced system in system util funcs
…mprove its UI (#509)

* use `NamedTuple` instead of `Pair` for better UI

* add `PoissonSpikeTrain` to `spike_affects` instead of `discrete_callbacks`

* add `generate_discrete_callback` dispatch for `PoissonSpikeTrain`

* access `NamedTuple` fields explicitly

* fix Poisson spike test

* rename `interval -> dt`

* fix more Poisson tests
* don't hide y axis in firing rate plot

* add `SPikeSource` abstract type alias and export relevant functions for custom sources

* generalize `generate_discrete_callbacks` for any spike source

* dispatch `system` separately for composite and non-composite bloxs to account for namespacing

* switch QIF spiking to discrete callback

* add `ContantInput` source

* revert back to continuous event for QIF spiking
* switch QIF neurons to use discrete events

* oops

* remove unnecessary printing
david-hofmann and others added 26 commits January 3, 2025 00:41
…494)

* Fix warning

* set PING jcn to zero

* Removing jcn(t)=0 from another neural mass

---------

Co-authored-by: Mason Protter <[email protected]>
* Update Project.toml

* Update Project.toml

* fix initial conditions for discrete jcns
* change all dispatches of `BloxConnector` to `Connector`

* export `Connector` and related convenience functions

* update all `<: CompositeBlox` to use `Connector`

* move PING neuron dispatches to `/src/blox/connections.jl`

* add `AdjacencyMatrix` constructors for `Connector`

* add `connectors_from_graph, returns `Vector{Connector}`

* update `connector_from_graph`

* update all `system_from_graph` utility functions

* update getter functions

* update graphs tests

* add `NoLearningRule`

* move `connect_action_selection!` dispatches to `src/blox/RL`

* cleanup old commented block

* include PING neurons before connections
* use `Vector{Vector}` and `Dict` in `Connector` fields to keep track of individual connections

* import `MTK.equations`

* improve `show` for `Connector`

* add getter functions for all `Connector` fields

* add `Vector{Vector}` wrapper function

* remove old `BloxConnector` getter functions

* change local variable name to not clash with getter function name

* add `equations(Connector)` argument to discrete callback generators to avoid accumulating them again

* adapt `AdjacencyMatrix` to new `Connector` field types
…#504)

* use `AdjacencyMatrix` instead of `get_adjacency`

* store `Vector{Connector}` in composite bloxs without reducing

* change `Vector{Vector}` to `Vector` for all `Connector` fields

* adapt system construction to new `Connector` fields

* `get_connector` always returns `Vector{Connector}`

* accumulate connection eqs per blox like `BloxConnector` used to

* adapt RL to new `Connector`

* fix show Connector

* fix RL test

* change adjacency colormap to grays

* add `get_connector`(s) util functions

* use correct connectors getter

* add token weight for Striatum=>Striatum connection

* use correct connectors getter
* reexport t and D from MTK

* add alias for `AbstractNeuronBlox` for brevity

* export functions for easier custom blox+connector definitions

* add generic spike affect and restructure existing one for LIF neurons

* add `system(blox)` to return (simplified) system

* option to choose between namespaced or not input equations in getter function

* add generic Connector dispatch

* add getter functions for spike affect states and params

* remove abstract neuron -> neuron Connector dispatch

* change values in `spike_affects` to `Vector{Tuple}` instead of `Tuple{Vector,Vector}`

* move functional spike affect to `Neurographs.jl`

* add generic fallback for discrete callbacks

* fix typo

* add `weight` argument to `connection_spike_affects`
* reexport t and D from MTK

* add alias for `AbstractNeuronBlox` for brevity

* export functions for easier custom blox+connector definitions

* add generic spike affect and restructure existing one for LIF neurons

* add `system(blox)` to return (simplified) system

* option to choose between namespaced or not input equations in getter function

* add generic Connector dispatch

* add getter functions for spike affect states and params

* remove abstract neuron -> neuron Connector dispatch

* change values in `spike_affects` to `Vector{Tuple}` instead of `Tuple{Vector,Vector}`

* move functional spike affect to `Neurographs.jl`

* add generic fallback for discrete callbacks

* fix typo

* add `weight` argument to `connection_spike_affects`

* import & export `outputs`

* extend `MTK.outputs` util fuction

* remove `output, jcn, voltage` fields, only keep metadata

* apply `outputs` function instead of field access

* rename `odesystem` field to `system`

* wrap `outputs` in `Num`

* capitalize voltage state `V`

* capitalize all occurences of `v` state

* actually capitalize all `v`

* try fixing the GD `output` error

* actually try fixing the GD test

* add `namespaced` kwarg for `outputs`

* fix output tag in PING neurons

* default to `namespaced=false` for shorter `outputs` return

* also expand equations, inputs, unknowns, parameters from MTK to work with blox

* use namespaced system in system util funcs
…mprove its UI (#509)

* use `NamedTuple` instead of `Pair` for better UI

* add `PoissonSpikeTrain` to `spike_affects` instead of `discrete_callbacks`

* add `generate_discrete_callback` dispatch for `PoissonSpikeTrain`

* access `NamedTuple` fields explicitly

* fix Poisson spike test

* rename `interval -> dt`

* fix more Poisson tests
* don't hide y axis in firing rate plot

* add `SPikeSource` abstract type alias and export relevant functions for custom sources

* generalize `generate_discrete_callbacks` for any spike source

* dispatch `system` separately for composite and non-composite bloxs to account for namespacing

* switch QIF spiking to discrete callback

* add `ContantInput` source

* revert back to continuous event for QIF spiking
* switch QIF neurons to use discrete events

* oops

* remove unnecessary printing
* updated CMC code (#474)

* switched from symbolic arrays to list of symbolic parameters. Needed to be able to set tunable flag for individual parameters of the array. Added untune! utility function to set tunable flag to false on list elements.

* added new approach to set tunable flag for the connection matrix also to the tutorial

* use generate_weight_param also in StimulusBlox and ObserverBlox connectors and set standard connection weight to non-tunable

* fixed and cleaned code

* minor changes

* update MTK compat

* added Project.toml to test

* fixed MTK compat once more

* added more packages to test environment needed in GraphDynamics tests

* remove test deps and unnecessary deps

* add Test to tect project

* remove Test dep from main Project

* add missing test deps

* add Statistics dep

* removed [extras] from Project.toml

* added [extras] again.

* fixed norm difference between MATLAB and Julia, MATLAB provides operator norms as default, thus use opnorm in Julia.

* fixed untune in tutorial
* start learning tutorial

* reduce size

* change data link

* remove data files (they are hosted in NeurobloxDocsHost)

* cleanup

* cortico-striatal small circuit

* clean up

* minor style changes

* add number of trials argument to `ClassificationEnvironment` constructor

* reduce learning rate to avoid weight oscillations (negative values)

* update cortico-cortical plasticity eaxmple

* add before & after adjacency plots

* add trace to return trial ID and agent accuracy in `run_experiment!`

* update tutorial

* tune parameters for learning tutorial

* add text

* add single trial run

* add trial print line

* remove unrolled `run_trial!` and add `verbose` kwarg

---------

Co-authored-by: haris organtzidis <[email protected]>
Co-authored-by: Mason Protter <[email protected]>
Copy link
Member

@hstrey hstrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@hstrey hstrey merged commit 664860c into master Jan 3, 2025
6 checks passed
@hstrey hstrey deleted the spDCM_tutorial_revisions branch January 3, 2025 01:50
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.

8 participants