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

Add Bouhadjar sequence learning network tutorial #1026

Merged
merged 127 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 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
49de8b6
Merge remote-tracking branch 'upstream/master' into clopath_synapse
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
ff0e8eb
add Bouhadjar sequence learning network tutorial
Apr 20, 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
0d51dae
Merge remote-tracking branch 'origin/third_factor_stdp' into sequence…
May 6, 2024
502a148
fix third-factor plasticity buffering and add third factor plasticity…
May 7, 2024
c91f598
add Bouhadjar sequence learning network tutorial
May 7, 2024
7eb99b5
Merge remote-tracking branch 'origin/third_factor_stdp' into sequence…
May 7, 2024
233334a
add Bouhadjar sequence learning network tutorial
May 9, 2024
c2ee609
add Bouhadjar sequence learning network tutorial
May 14, 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
4fa749d
Merge remote-tracking branch 'origin/master' into nest-delay
May 31, 2024
299873b
Merge remote-tracking branch 'upstream/master' into third_factor_stdp
Jun 4, 2024
d471cdf
fix third-factor plasticity buffering and add third factor plasticity…
Jun 5, 2024
3c1a15f
Merge remote-tracking branch 'origin/master' into nest-delay
Jun 5, 2024
b6f91a3
fix special handling of NEST delay and weight variables in synapse
Jun 5, 2024
49c1bf9
Merge remote-tracking branch 'upstream/master' into third_factor_stdp
Jun 5, 2024
86f0c6f
fix third-factor plasticity buffering and add third factor plasticity…
Jun 5, 2024
61a25ac
Merge remote-tracking branch 'origin/master' into nest-delay
Jun 5, 2024
903fef3
fix special handling of NEST delay and weight variables in synapse
Jun 5, 2024
eb023db
fix special handling of NEST delay and weight variables in synapse
Jun 5, 2024
ecd9394
fix special handling of NEST delay and weight variables in synapse
Jun 6, 2024
8135f9d
fix typo
clinssen Jun 6, 2024
e3b56c3
Merge remote-tracking branch 'origin/nest-delay' into third_factor_stdp
Jun 6, 2024
883d620
Merge remote-tracking branch 'origin/third_factor_stdp' into third_fa…
Jun 8, 2024
2681a09
apply suggestions from code review
clinssen Jun 10, 2024
0d7d106
fix third-factor plasticity buffering and add third factor plasticity…
Jun 11, 2024
08265b2
fix third-factor plasticity buffering and add third factor plasticity…
Jun 11, 2024
f24ef80
fix third-factor plasticity buffering and add third factor plasticity…
Jun 11, 2024
264c98c
Merge remote-tracking branch 'origin/nest-delay' into third_factor_stdp
Jun 11, 2024
cabae78
add Bouhadjar sequence learning network tutorial
Jun 13, 2024
b7ef615
fix third-factor plasticity buffering and add third factor plasticity…
Jun 18, 2024
1e9dcc3
Merge remote-tracking branch 'upstream/master' into third_factor_stdp
Jun 18, 2024
4f937be
fix third-factor plasticity buffering and add third factor plasticity…
Jun 18, 2024
6d81daf
fix third-factor plasticity buffering and add third factor plasticity…
Jun 18, 2024
fb73c55
Merge remote-tracking branch 'upstream/master' into sequence_learning
Jun 18, 2024
f84786a
fix third-factor plasticity buffering and add third factor plasticity…
Jun 18, 2024
90cc88b
Merge remote-tracking branch 'origin/third_factor_stdp' into sequence…
Jun 18, 2024
2a9772d
Merge remote-tracking branch 'upstream/master' into third_factor_stdp
Jun 19, 2024
8e19b8c
fix third-factor plasticity buffering and add third factor plasticity…
Jun 20, 2024
4ee113b
fix third-factor plasticity buffering and add third factor plasticity…
Jun 20, 2024
e0e2521
fix third-factor plasticity buffering and add third factor plasticity…
Jun 20, 2024
7061348
add Bouhadjar sequence learning network tutorial
Jun 20, 2024
4d72595
Merge remote-tracking branch 'origin/third_factor_stdp' into sequence…
Jun 20, 2024
fb15711
add code generator option for spike-based postsynaptic third factor b…
Jul 4, 2024
4314758
Merge remote-tracking branch 'origin/third_factor_stdp_spike_based' i…
Jul 4, 2024
a9be621
add Bouhadjar sequence learning network tutorial
Jul 5, 2024
c59931b
add Bouhadjar sequence learning network tutorial
Jul 8, 2024
5457e51
add Bouhadjar sequence learning network tutorial
Jul 8, 2024
c69ca74
add code generator option for spike-based postsynaptic third factor b…
Jul 8, 2024
e4479d6
add Bouhadjar sequence learning network tutorial
Jul 9, 2024
06e0486
Merge remote-tracking branch 'upstream/master' into sequence_learning
Oct 16, 2024
d07a6c5
add Bouhadjar sequence learning network tutorial
Oct 16, 2024
313b958
fix third-factor plasticity buffering and add third factor plasticity…
Oct 16, 2024
bdbcb7b
add Bouhadjar sequence learning network tutorial
Oct 16, 2024
b2785aa
Merge remote-tracking branch 'upstream/master' into sequence_learning
Nov 5, 2024
9cf976c
add Bouhadjar sequence learning network tutorial
Nov 5, 2024
a6a8005
Merge remote-tracking branch 'upstream/master' into sequence_learning
Nov 6, 2024
fe65717
add Bouhadjar sequence learning network tutorial
Nov 6, 2024
d9c0378
Merge remote-tracking branch 'upstream/master' into sequence_learning
Nov 6, 2024
507be89
Merge remote-tracking branch 'upstream/master' into sequence_learning
Nov 6, 2024
fef8af1
Merge remote-tracking branch 'upstream/master' into sequence_learning
Nov 13, 2024
a512881
add Bouhadjar sequence learning network tutorial
Nov 16, 2024
aa7fd31
minor corrections and restructuring section on experiment 3 (#15)
YounesBouhadjar Dec 9, 2024
2db1dc5
Merge remote-tracking branch 'upstream/master' into sequence_learning
Dec 9, 2024
5c7ae9f
add Bouhadjar sequence learning network tutorial
Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
"""
iaf_psc_exp_nonlineardendrite_neuron
####################################


Copyright statement
+++++++++++++++++++

This file is part of NEST.

Copyright (C) 2004 The NEST Initiative

NEST is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

NEST is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with NEST. If not, see <http://www.gnu.org/licenses/>.
"""

model iaf_psc_exp_nonlineardendrite_neuron:

state:
V_m mV = 0 mV # membrane potential in mV
dAP_trace pA = 0 pA # dAP trace
active_dendrite boolean = false
active_dendrite_readout real = 0. # an extra readout is included so the state can be recorded in NEST; see https://github.com/nest/nestml/issues/986
dAP_counts integer = 0
ref_counts integer = 0
I_dend pA = 0 pA
I_dend$ pA/ms = 0 pA/ms

equations:
# exponential shaped postsynaptic current kernel
kernel I_kernel1 = exp(-1/tau_syn1*t)

# alpha shaped postsynaptic current kernel
I_dend' = I_dend$ - I_dend / tau_syn2
I_dend$' = -I_dend$ / tau_syn2

# exponential shaped postsynaptic current kernel
kernel I_kernel3 = exp(-1/tau_syn3*t)

# diff. eq. for membrane potential
inline I_syn pA = convolve(I_kernel1, I_1) * pA - convolve(I_kernel3, I_3) * pA + I_e
V_m' = -(V_m - E_L)/tau_m + (I_syn + I_dend) / C_m

# diff. eq. for dAP trace
dAP_trace' = -evolve_dAP_trace * dAP_trace / tau_h

parameters:
C_m pF = 250 pF # capacitance of the membrane
tau_m ms = 20 ms # membrane time constant
tau_syn1 ms = 10 ms # time constant of synaptic current, port 1
tau_syn2 ms = 10 ms # time constant of synaptic current, port 2
tau_syn3 ms = 10 ms # time constant of synaptic current, port 3
tau_h ms = 400 ms # time constant of the dAP trace
V_th mV = 25 mV # spike threshold
V_reset mV = 0 mV # reset voltage
E_L mV = 0mV # resting potential.
evolve_dAP_trace real = 1 # set to 0 to stop integrating dAP_trace
I_e pA = 0pA # external current.

# dendritic action potential
theta_dAP pA = 60 pA # current threshold for a dendritic action potential
I_p pA = 250 pA # current clamp value for I_dAP during a dendritic action potential
tau_dAP ms = 60 ms # time window over which the dendritic current clamp is active
dAP_timeout_ticks integer = steps(tau_dAP)

# refractory parameters
t_ref ms = 10 ms # refractory period
ref_timeout_ticks integer = steps(t_ref)

I_dend_incr pA/ms = pA * exp(1) / tau_syn2


input:
I_1 <- spike
I_2 <- spike
I_3 <- spike

output:
spike

onReceive(I_2):
I_dend$ += I_2 * s * I_dend_incr

update:
# solve ODEs
integrate_odes()

# current-threshold, emit a dendritic action potential
if I_dend > theta_dAP or active_dendrite:
if dAP_counts == 0:

if active_dendrite == false:
# starting dAP
dAP_trace += 1 pA
active_dendrite = true
active_dendrite_readout = 1.
pnbabu marked this conversation as resolved.
Show resolved Hide resolved
I_dend = I_p
dAP_counts = dAP_timeout_ticks
else:
# ending dAP
I_dend = 0 pA
active_dendrite = false
active_dendrite_readout = 0.

# the following assignment to I_dend$ reproduces a bug in the original implementation. It is included here to replicate the results of the original model
c1 real = -resolution() * exp(-resolution() / tau_syn2) / tau_syn2**2
c2 real = (-resolution() + tau_syn2) * exp(-resolution() / tau_syn2) / tau_syn2
I_dend$ = I_p * c1 / (1 - c2) / ms

else:
dAP_counts -= 1
I_dend = I_p

# threshold crossing and refractoriness
if ref_counts == 0:
if V_m > V_th:
emit_spike()
ref_counts = ref_timeout_ticks
V_m = V_reset
dAP_counts = 0
I_dend = 0 pA
active_dendrite = false
active_dendrite_readout = 0.
else:
ref_counts -= 1
V_m = V_reset
active_dendrite = false
active_dendrite_readout = 0.
dAP_counts = 0
I_dend = 0 pA

3,925 changes: 3,925 additions & 0 deletions doc/tutorials/sequence_learning/sequence_learning.ipynb

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions doc/tutorials/tutorials_list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ Creating neuron models

Create a model that emits spikes according to an inhomogeneous Poisson distribution.

* :doc:`Sequence learning network </tutorials/sequence_learning/sequence_learning>`

A network learns to predict and autonomously replay sequences of items.


Creating synapse models
-----------------------
Expand Down
82 changes: 82 additions & 0 deletions models/synapses/stdsp_synapse.nestml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
"""
stdsp_synapse - Synapse model for spike-timing dependent plasticity with postsynaptic third-factor modulation
#############################################################################################################

Description
+++++++++++

References
++++++++++

"""
model stdsp_synapse:
state:
permanence real = 1.
t_last_pre_spike ms = 0 ms
pre_trace real = 0.
w real = 100. # dummy synaptic weight

parameters:
d ms = 1 ms # Synaptic transmission delay

tau_pre_trace ms = 80 ms
lambda_h real = 1.
zt pA = 1 pA
lambda_plus real = .01
lambda_minus real = 1.
Wmax real = 100.
permanence_max real = 100.
permanence_min real = 0.
dt_min ms = 4 ms
dt_max ms = 100 ms

permanence_threshold real = 10.

Wmin real = 0.

equations:
pre_trace' = -pre_trace / tau_pre_trace

input:
pre_spikes <- spike
post_spikes <- spike
dAP_trace pA <- continuous

output:
spike(weight real, delay ms)

onReceive(post_spikes):
time_since_last_spike ms = t - t_last_pre_spike

if time_since_last_spike < dt_max and time_since_last_spike > dt_min:
# facilitation
norm_perm real = permanence / permanence_max + lambda_plus * pre_trace
permanence = min(norm_perm * permanence_max, permanence_max)

# homeostasis
permanence += lambda_h * (zt - dAP_trace) / pA * permanence_max
permanence = min(permanence, permanence_max)
permanence = max(permanence, permanence_min)

onReceive(pre_spikes):
t_last_pre_spike = t

pre_trace += 1.

# depress synapse
permanence -= lambda_minus * permanence_max
permanence = max(permanence, permanence_min)

if permanence > permanence_threshold:
# set a dummy "weight" so the weight can be recorded
w = Wmax

# deliver spike to postsynaptic partner
emit_spike(w, d)
else:
# set a dummy "weight" so the weight can be recorded
w = 0.

update:
# solve ODEs
integrate_odes()
Loading