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

Fix third-factor plasticity buffering and add third factor plasticity tutorial #1027

Open
wants to merge 65 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
87311c5
fix and add test for second-order integration in neuromodulated synapse
May 10, 2023
9e69c48
Merge remote-tracking branch 'upstream/master' into dopa_neuron_secon…
Jul 3, 2023
33fb1de
fix second-order integration
Jul 3, 2023
a3b11bf
add Clopath synapse
Jul 5, 2023
c5b1b1a
Merge remote-tracking branch 'upstream/master' into dopa_neuron_secon…
Jul 5, 2023
4b0c128
fix second-order integration
Jul 6, 2023
de7a28e
Merge remote-tracking branch 'clinssen/dopa_neuron_second_order' into…
Jul 6, 2023
7fef01a
add Clopath synapse
Jul 7, 2023
41354de
add Clopath synapse support
Jul 10, 2023
d67810f
fix symbol table in neuron/synapse model copy
Jul 19, 2023
652966d
cleanup
Jul 19, 2023
37f2949
Merge branch 'integrate_specific_odes' into clopath_synapse
Nov 12, 2023
2ff8033
add Clopath synapse
Nov 13, 2023
ebbc565
add Clopath synapse [noci]
Nov 20, 2023
8524e5c
add Clopath synapse [noci]
Nov 20, 2023
3efd1f3
add support for clopath synapse
Dec 6, 2023
c46f6e1
merge origin/integrate_specific_odes
Dec 6, 2023
40ad5dd
add support for clopath synapse
Dec 6, 2023
a90d571
add support for clopath synapse [noci]
Dec 21, 2023
f862bad
change third factor STDP plasticity unit test into a notebook tutorial
Dec 21, 2023
63ed5ce
change third factor STDP plasticity unit test into a notebook tutorial
Jan 9, 2024
067aa0a
change third factor STDP plasticity unit test into a notebook tutorial
Jan 11, 2024
dae25e2
change third factor STDP plasticity unit test into a notebook tutorial
Jan 18, 2024
8e2b330
add sequence learning tutorial after Bouhadjar et al
Feb 12, 2024
a9f4b06
add sequence learning tutorial after Bouhadjar et al
Feb 18, 2024
f2fa28e
add sequence learning tutorial after Bouhadjar et al
Feb 27, 2024
931af3c
add sequence learning tutorial after Bouhadjar et al
Feb 29, 2024
4510d90
add sequence learning tutorial after Bouhadjar et al
Mar 21, 2024
8fa7588
sequence learning notebook updates
Apr 17, 2024
521fca6
Merge remote-tracking branch 'origin/integrate_specific_odes' into cl…
Apr 17, 2024
593a180
sequence learning notebook updates
Apr 17, 2024
0ef7e61
sequence learning notebook updates
Apr 17, 2024
d36d49a
fix third factor stdp synapse tutorial
Apr 18, 2024
641f35f
fix third factor stdp synapse tutorial
Apr 18, 2024
b11d784
sequence learning notebook updates
Apr 18, 2024
65b1390
sequence learning notebook updates
Apr 19, 2024
461610c
Merge remote-tracking branch 'upstream/master' into third_factor_stdp
Apr 19, 2024
087dc65
fix third-factor plasticity buffering and add third factor plasticity…
Apr 19, 2024
861c1a5
fix third-factor plasticity buffering and add third factor plasticity…
Apr 23, 2024
8d23bcd
Merge remote-tracking branch 'upstream/master' into third_factor_stdp
Apr 23, 2024
99a343d
fix third-factor plasticity buffering and add third factor plasticity…
Apr 24, 2024
73c46cc
fix third-factor plasticity buffering and add third factor plasticity…
Apr 24, 2024
46648fb
fix special handling of NEST delay and weight variables in synapse
Apr 25, 2024
267bbf1
fix special handling of NEST delay and weight variables in synapse
Apr 29, 2024
abe6577
fix special handling of NEST delay and weight variables in synapse
Apr 29, 2024
c5e091f
fix special handling of NEST delay and weight variables in synapse
Apr 29, 2024
0437f18
Merge remote-tracking branch 'origin/nest-delay' into third_factor_stdp
Apr 29, 2024
db48b95
fix special handling of NEST delay and weight variables in synapse
Apr 30, 2024
71605d3
fix special handling of NEST delay and weight variables in synapse
Apr 30, 2024
c46f73d
fix special handling of NEST delay and weight variables in synapse
Apr 30, 2024
70befa5
fix special handling of NEST delay and weight variables in synapse
Apr 30, 2024
05abf0b
fix special handling of NEST delay and weight variables in synapse
Apr 30, 2024
faa0c86
fix special handling of NEST delay and weight variables in synapse
Apr 30, 2024
2e9dbe5
Merge remote-tracking branch 'origin/nest-delay' into third_factor_stdp
Apr 30, 2024
13fbac1
fix third-factor plasticity buffering and add third factor plasticity…
Apr 30, 2024
890fe1d
fix third-factor plasticity buffering and add third factor plasticity…
May 2, 2024
19e6682
fix third-factor plasticity buffering and add third factor plasticity…
May 5, 2024
146c737
fix third-factor plasticity buffering and add third factor plasticity…
May 6, 2024
f18479e
fix third-factor plasticity buffering and add third factor plasticity…
May 6, 2024
502a148
fix third-factor plasticity buffering and add third factor plasticity…
May 7, 2024
32bd550
fix third-factor plasticity buffering and add third factor plasticity…
May 16, 2024
3bc2715
fix third-factor plasticity buffering and add third factor plasticity…
May 16, 2024
5821fd0
fix third-factor plasticity buffering and add third factor plasticity…
May 22, 2024
ac934bc
Merge branch 'master' into third_factor_stdp
clinssen May 22, 2024
548e028
Merge remote-tracking branch 'origin/third_factor_stdp' into third_fa…
May 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 0 additions & 8 deletions doc/models_library/index.rst
Expand Up @@ -376,14 +376,6 @@ stdp_triplet - Synapse type with triplet spike-timing dependent plasticity
Source file: `stdp_triplet_synapse <https://www.github.com/nest/nestml/blob/master/models/synapses/stdp_triplet_synapse.nestml>`_


:doc:`third_factor_stdp_synapse <third_factor_stdp_synapse>`
------------------------------------------------------------

Synapse model for spike-timing dependent plasticity with postsynaptic third-factor modulation

Source file: `third_factor_stdp_synapse <https://www.github.com/nest/nestml/blob/master/models/synapses/third_factor_stdp_synapse.nestml>`_


:doc:`neuromodulated_stdp_synapse <neuromodulated_stdp_synapse>`
----------------------------------------------------------------

Expand Down
86 changes: 0 additions & 86 deletions doc/models_library/third_factor_stdp_synapse.rst

This file was deleted.

97 changes: 7 additions & 90 deletions doc/nestml_language/synapses_in_nestml.rst
Expand Up @@ -131,11 +131,9 @@ Third-factor plasticity

The postsynaptic trace value in the models so far is assumed to correspond to a property of the postsynaptic neuron, but it is specified in the synapse model. Some synaptic plasticity rules require access to a postsynaptic value that cannot be specified as part of the synapse model, but is a part of the (postsynaptic) neuron model.

An example would be a neuron that generates dendritic action potentials. The synapse could need access to the postsynaptic dendritic current. For more details on this example, please see the tutorial https://nestml.readthedocs.io/en/latest/tutorials/active_dendrite/nestml_active_dendrite_tutorial.html
An example would be a neuron that generates dendritic action potentials. (For more details about this neuron model, please see the tutorial https://nestml.readthedocs.io/en/latest/tutorials/active_dendrite/nestml_active_dendrite_tutorial.html.) The synapse could need access to the postsynaptic dendritic current.

An additional complication is that when combining models from different sources, the naming convention can be different between the neuron and synapse model.

To make the "third factor" value available in the synapse model, begin by defining an appropriate input port:
To make this "third factor" value available in the synapse model, begin by defining an appropriate input port:

.. code-block:: nestml

Expand All @@ -147,24 +145,19 @@ In the synapse, the value will be referred to as ``I_post_dend`` and can be used
.. code-block:: nestml

onReceive(post_spikes):
# potentiate synapse
w_ real = # [...] normal STDP update rule
w_ = (I_post_dend / pA) * w_ + (1 - I_post_dend / pA) * w # "gating" of the weight update
w = min(Wmax, w_)
w_ = (I_post_dend / I_post_dend_peak) * w_
+ (1 - I_post_dend / I_post_dend_peak) * w # "gating" of the weight update

In the neuron, no special output port is required; all state variables are accessible for the third factor rules.

NESTML needs to be invoked so that it generates code for neuron and synapse together. Additionally, specify the ``"post_ports"`` entry to connect the input port on the synapse with the right variable of the neuron (see :ref:`Generating code`).
NESTML needs to be invoked so that it generates code for neuron and synapse together. Additionally, specify the ``"post_ports"`` entry to connect the input port on the synapse with the right variable of the neuron (see :ref:`Generating code`). Passing this as a code generator option facilitates comining models from different sources, where the naming conventions can be different between the neuron and synapse model.

In this example, the ``I_dend`` state variable of the neuron will be simply an exponentially decaying function of time, which can be set to 1 at predefined times in the simulation script. By inspecting the magnitude of the weight updates, we see that the synaptic plasticity is indeed being gated by the neuronal state variable ("third factor") ``I_dend``.
In this example, the ``I_dend`` state variable of the neuron will be simply an exponentially decaying function of time, which can be clamped at predefined times in the simulation script. By inspecting the magnitude of the weight updates, we see that the synaptic plasticity is indeed being gated by the neuronal state variable ("third factor") ``I_dend``.

.. figure:: https://raw.githubusercontent.com/nest/nestml/master/doc/fig/stdp_triplet_synapse_test.png

For a full example, please see the following files:

* ``tests/nest_tests/third_factor_stdp_synapse_test.py`` (produces the figure)
* ``models/neurons/iaf_psc_exp_dend_neuron.nestml`` (neuron model)
* ``models/synapses/third_factor_stdp_synapse.nestml`` (synapse model)
For a full example, please see :doc:`Third-factor modulated STDP </tutorials/stdp_third_factor_active_dendrite/stdp_third_factor_active_dendrite>`.


Examples
Expand Down Expand Up @@ -488,82 +481,6 @@ Further integration with NEST Simulator is planned, to achieve a just-in-time co
Code generator options instruct the target platform code generator (in this case, NEST) how to process the models.



The NEST target
---------------

Event-based updating
~~~~~~~~~~~~~~~~~~~~

NEST target synapses are not allowed to have any time-based internal dynamics (ODEs). This is due to the fact that synapses are, unlike nodes, not updated on a regular time grid.

The synapse is allowed to contain an ``update`` block. Statements in the ``update`` block are executed whenever the internal state of the synapse is updated from one timepoint to the next; these updates are typically triggered by incoming spikes. The NESTML ``resolution()`` function will return the time that has elapsed since the last event was handled.


Dendritic delay
~~~~~~~~~~~~~~~

In NEST, all synapses are expected to specify a nonzero dendritic delay, that is, the delay between arrival of a spike at the dendritic spine and the time at which its effects are felt at the soma (or conversely, the delay between a somatic action potential and the arrival at the dendritic spine due to dendritic backpropagation). To indicate that a given parameter is specifying this NEST-specific delay value, use an annotation:

.. code:: nestml

parameters:
dend_delay ms = 1 ms @nest::delay


Generating code
---------------

When NESTML is invoked to generate code for plastic synapses, the code generator needs to know which neuron model the synapses will be connected to, so that it can generate fast C++ code for the neuron and the synapse that is mutually dependent at runtime. These pairs can be specified as a list of two-element dictionaries of the form :python:`{"neuron": "neuron_model_name", "synapse": "synapse_model_name"}`, for example:

.. code-block:: python

generate_target(...,
codegen_opts={...,
"neuron_synapse_pairs": [{"neuron": "iaf_psc_exp_dend",
"synapse": "third_factor_stdp"}]})

Additionally, if the synapse requires it, specify the ``"post_ports"`` entry to connect the input port on the synapse with the right variable of the postsynaptic neuron:

.. code-block:: python

generate_target(...,
codegen_opts={...,
"neuron_synapse_pairs": [{"neuron": "iaf_psc_exp_dend",
"synapse": "third_factor_stdp",
"post_ports": ["post_spikes",
["I_post_dend", "I_dend"]]}]})

This specifies that the neuron ``iaf_psc_exp_dend`` has to be generated paired with the synapse ``third_factor_stdp``, and that the input ports ``post_spikes`` and ``I_post_dend`` in the synapse are to be connected to the postsynaptic partner. For the ``I_post_dend`` input port, the corresponding variable in the (postsynaptic) neuron is called ``I_dend``.

Simulation of volume-transmitted neuromodulation in NEST can be done using "volume transmitter" devices [5]_. These are event-based and should correspond to a "spike" type input port in NESTML. The code generator options keyword "vt_ports" can be used here.

.. code-block:: python

generate_target(...,
codegen_opts={...,
"neuron_synapse_pairs": [{"neuron": "iaf_psc_exp_dend",
"synapse": "third_factor_stdp",
"vt_ports": ["dopa_spikes"]}]})



Implementation notes
~~~~~~~~~~~~~~~~~~~~

Note that ``access_counter`` now has an extra multiplicative factor equal to the number of trace values that exist, so that spikes are removed from the history only after they have been read out for the sake of computing each trace.

.. figure:: https://www.frontiersin.org/files/Articles/1382/fncom-04-00141-r1/image_m/fncom-04-00141-g003.jpg

Potjans et al. 2010

Random numbers
~~~~~~~~~~~~~~

In case random numbers are needed inside the synapse, the random number generator belonging to the postsynaptic target is used.



References
----------

Expand Down