Skip to content

Commit ffa9737

Browse files
committed
revision to stp-syn, and further dev on stp lesson doc
1 parent 4369359 commit ffa9737

File tree

3 files changed

+59
-6
lines changed

3 files changed

+59
-6
lines changed

docs/tutorials/neurocog/short_term_plasticity.md

+48-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,51 @@
11
# Lecture 4D: Short-Term Plasticity
22

3-
In this lesson, we will study how short-term plasticity (STDP) dynamics
3+
In this lesson, we will study how short-term plasticity (STP) dynamics
44
using one of ngc-learn's in-built synapses, the `STPDenseSynapse`.
55
Specifically, we will study how a dynamic synapse may be constructed and
6-
examine what short-term depression (STD) and short-term facilitation dominated
7-
configurations of an STP synapse look like.
6+
examine what short-term depression (STD) and short-term facilitation
7+
(STF) dominated configurations of an STP synapse look like.
88

99
## Probing Short-Term Plasticity
1010

11+
Go ahead and make a new folder for this study and create a Python script,
12+
i.e., `run_shortterm_plasticity.py`, to write your code for this part of the
13+
tutorial.
14+
15+
We will write a 3-component dynamical system that connects a Poisson input
16+
encoding cell to a leaky integrate-and-fire (LIF) cell via a single dynamic
17+
synapse that evolves according to STP. We will first write our
18+
simulation of this dynamic synapse from the perspective of STF-dominated
19+
dynamics, plotting out the results under two different Poisson spike trains
20+
with different spiking frequencies. Then, we will modify our simulation
21+
to emulate dynamics from a STD-dominated perspective.
22+
1123
### Starting with Facilitation-Dominated Dynamics
1224

25+
One experiment goal with using a "dynamic synapse" is often to computationally
26+
model the fact that synaptic efficacy (strength/conductance magnitude) is
27+
not a fixed quantity (even in cases where long-term adaptation/learning is
28+
absent) and instead a time-varying property that depends on a fixed
29+
quantity of biophysical resources, e.g., neurotransmitter chemicals. This
30+
means, in the context of spiking cells, when a pre-synaptic neuron emits a
31+
pulse, this will affect the relative magnitude of the synapse's efficacy;
32+
in some cases, this will result in an increase (facilitation) and, in others,
33+
this will result in a decrease (depression) that lasts over a short period
34+
of time (several milliseconds in many instances). Considering the fact
35+
synapses have a dynamic nature to them, both over short and long time-scales,
36+
means that plasticity can be thought of as a stimulus and resource-dependent
37+
quantity, reflecting an important biophysical aspect that affects how
38+
neuronal systems adapt and generalize given different kinds of sensory
39+
stimuli.
40+
41+
Writing our STP dynamic synapse can be done by importing
42+
[STPDenseSynapse](ngclearn.components.synapses.STPDenseSynapse)
43+
from ngc-learn's in-built components and using it to wire the output
44+
spike compartment of the `PoissonCell` to the input electrical current
45+
compartment of the `LIFCell`. This can be done as follows (using the
46+
meta-parameters we provide in the code block below to ensure
47+
STF-dominated dynamics):
48+
1349
```python
1450
from jax import numpy as jnp, random, jit
1551
from ngcsimlib.context import Context
@@ -63,6 +99,15 @@ with Context("Model") as model:
6399
z0.inputs.set(obs)
64100
```
65101

102+
Notice that the `STPDenseSynapse` has two important time constants to configure;
103+
`tau_f` ($\tau_f$), the facilitation time constant, and `tau_d` ($\tau_d$, the
104+
depression time constant. In effect, it is these two constants that you will
105+
want to set to obtain different desired behavior from this in-built dynamic
106+
synapse -- setting $\tau_f > \tau_d$ will result in STF-dominated behavior
107+
whereas setting $\tauf < \tau_d$ will produce STD-dominated behavior. Note
108+
that setting $\tau_d = 0$ will result in short-term depression being turned off
109+
completely ($\tau_f 0$ disables STF).
110+
66111
We can then write the simulated input Poisson spike train as follows:
67112

68113
```python

ngclearn/components/neurons/graded/rateCell.py

+2
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ class RateCell(JaxComponent): ## Rate-coded/real-valued cell
140140
:Note: setting the integration type to the midpoint method will
141141
increase the accuray of the estimate of the cell's evolution
142142
at an increase in computational cost (and simulation time)
143+
144+
resist_scale: a scaling factor applied to incoming current `j` (default: 1)
143145
"""
144146

145147
# Define Functions

ngclearn/components/synapses/STPDenseSynapse.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ class STPDenseSynapse(DenseSynapse): ## short-term plastic synaptic cable
4444
this to < 1 and > 0. will result in a sparser synaptic structure
4545
(lower values yield sparse structure)
4646
47-
tau_f: short-term facilitation time constant (default: 750 ms)
47+
tau_f: short-term facilitation (STF) time constant (default: `750` ms); note
48+
that setting this to `0` ms will disable STF
4849
49-
tau_d: shoft-term depression time constant (default: 50 ms)
50+
tau_d: shoft-term depression time constant (default: `50` ms); note
51+
that setting this to `0` ms will disable STD
5052
5153
resources_int: initialization kernel for synaptic resources matrix
5254
"""
@@ -80,7 +82,11 @@ def _advance_state(tau_f, tau_d, Rscale, inputs, weights, biases, resources,
8082
u, x, Wdyn):
8183
s = inputs
8284
## compute short-term facilitation
83-
u = u - u * (1./tau_f) + (resources * (1. - u)) * s #jnp.sum(..., axis=1, keepdims=True)
85+
#u = u - u * (1./tau_f) + (resources * (1. - u)) * s
86+
if tau_f > 0.: ## compute short-term facilitation
87+
u = u - u * (1./tau_f) + (resources * (1. - u)) * s
88+
else:
89+
u = resources ## disabling STF yields fixed resource u variables
8490
## compute dynamic synaptic values/conductances
8591
Wdyn = (weights * u * x) * s + Wdyn * (1. - s) ## OR: -W/tau_w + W * u * x
8692
if tau_d > 0.:

0 commit comments

Comments
 (0)