You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traces represent one very important component tool in ngc-learn as these are
4
-
often, in biophysical model simulations, used to produce real-valued
5
-
representations of often discrete-valued patterns, e.g., spike vectors within
6
-
a spike train, that can facilitate mechanisms such as online biological credit
7
-
assignment. In this lesson, we will observe how one of ngc-learn's core
8
-
trace components -- the `VarTrace` -- operates.
3
+
Traces represent one very important component tool in ngc-learn as these are often, in biophysical model simulations, used to produce real-valued representations of often discrete-valued patterns, e.g., spike vectors within a spike train, that can facilitate mechanisms such as online biological credit assignment. In this lesson, we will observe how one of ngc-learn's core trace components -- the `VarTrace` -- operates.
9
4
10
5
## Setting Up a Variable Trace for a Poisson Spike Train
11
6
12
-
To observe the value of a variable trace, we will pair it to another in-built
13
-
ngc-component; the `PoissonCell`, which will be configured to emit spikes
14
-
approximately at `63.75` Hertz (yielding a fairly sparse spike train). This means
15
-
we will construct a two-component dynamical system, where the input
16
-
compartment `outputs` of the `PoissonCell` will be wired directly into the
17
-
`inputs` compartment of the `VarTrace`. Note that a `VarTrace` has an `inputs`
18
-
compartment -- which is where raw signals typically go into -- and a `trace`
19
-
output compartment -- which is where filtered signal values/by-products are emitted from.
7
+
To observe the value of a variable trace, we will pair it to another in-built ngc-component; the `PoissonCell`, which will be configured to emit spikes approximately at `63.75` Hertz (yielding a fairly sparse spike train). This means we will construct a two-component dynamical system, where the input compartment `outputs` of the `PoissonCell` will be wired directly into the `inputs` compartment of the `VarTrace`. Note that a `VarTrace` has an `inputs` compartment -- which is where raw signals typically go into -- and a `trace` output compartment -- which is where filtered signal values/by-products are emitted from.
20
8
21
9
The code below will instantiate the paired Poisson cell and corresponding variable trace:
22
10
23
11
```python
24
12
from jax import numpy as jnp, random, jit
25
-
from ngclearn.utils import JaxProcess
26
-
fromngcsimlib.contextimport Context
13
+
14
+
fromngclearnimport Context, MethodProcess
27
15
## import model-specific mechanisms
28
16
from ngclearn.components.input_encoders.poissonCell import PoissonCell
29
17
from ngclearn.components.other.varTrace import VarTrace
@@ -37,30 +25,24 @@ with Context("Model") as model:
## set up some utility functions for the model context
39
+
defclamp(x):
40
+
cell.inputs.set(x)
56
41
```
57
42
58
43
## Running the Paired Cell-Trace System
59
44
60
-
We can then run the above two-component dynamical system by injecting a fixed
61
-
(valid) probability value into the Poisson input encoder and then record the
62
-
resulting spikes and trace values. We will do this for `T = 200` milliseconds (ms)
63
-
with the code below:
45
+
We can then run the above two-component dynamical system by injecting a fixed (valid) probability value into the Poisson input encoder and then record the resulting spikes and trace values. We will do this for `T = 200` milliseconds (ms) with the code below:
Notice that every time a spike is produced by the Poisson encoding cell, the trace
115
-
increments by `0.5` -- the result of the `a_delta` hyper-parameter we set when
116
-
crafting the model and simulation object -- and then exponentially decays in
117
-
the absence of a spike (with the time constant of `tau_tr = 30` milliseconds).
94
+
Notice that every time a spike is produced by the Poisson encoding cell, the trace increments by `0.5` -- the result of the `a_delta` hyper-parameter we set when crafting the model and simulation object -- and then exponentially decays in the absence of a spike (with the time constant of `tau_tr = 30` milliseconds).
118
95
119
-
The variable trace can be further configured to filter signals in different ways
120
-
if desired; specifically by manipulating its `decay_type` and `a_delta` arguments.
121
-
Notably, if a piecewise-gated variable trace is desired (a very common choice
122
-
in some neuronal circuit models), then all one would have to do is set `a_delta = 0`,
123
-
yielding the following line in the model creation code earlier in this tutorial:
96
+
The variable trace can be further configured to filter signals in different ways if desired; specifically by manipulating its `decay_type` and `a_delta` arguments. Notably, if a piecewise-gated variable trace is desired (a very common choice in some neuronal circuit models), then all one would have to do is set `a_delta = 0`, yielding the following line in the model creation code earlier in this tutorial:
Notice that, this time, when a spike is emitted from the Poisson cell, the trace
135
-
is "clamped" to the value of one and then exponentially decays. Such a trace
136
-
configuration is useful if one requires the maintained trace to never increase
137
-
beyond a value of one, preventing divergence or run-away values if a spike train
138
-
is particularly dense and yielding friendlier values for biological learning
139
-
rules.
106
+
Notice that, this time, when a spike is emitted from the Poisson cell, the trace is "clamped" to the value of one and then exponentially decays. Such a trace configuration is useful if one requires the maintained trace to never increase beyond a value of one, preventing divergence or run-away values if a spike train is particularly dense and yielding friendlier values for biological learning rules.
0 commit comments