Input Encoders
The input encoder is generally a utility component for encoding sensory input / data in a certain way. A typical use-case for an input encoder in the context of spiking neural networks is to integrate a non-parameterized transformation into a system that, ideally on-the-fly, transforms a input pattern(s) to a spike trains – for example, one can use a PoissonCell to transform a fixed input into an approximate spike train with a maximum frequency (in Hertz). Some of these encoders, such as the Bernoulli and Poisson cells, can be interpreted as coarse-grained approximations of dynamics that would normally be modeled by complex differential equations.
Input Encoding Operator Types
Input encoders generally take some data pattern(s) and transforms it to
another desired form, i.e., a real-valued vector to a sample of a spike train
at time t. Some input encoder components can emulate aspects of biological/
biophysical cells, e.g., the Poisson-distributed nature of the spikes emitted by
certain neuronal cells, or populations of them, e.g., Gaussian population
encoding.
Bernoulli Cell
This cell takes a real-valued pattern(s) and transforms it on-the-fly to
a spike train where each spike vector is a sample of multivariate Bernoulli
distribution (the probability of a spike is proportional to the intensity of
the input vector value). NOTE: this assumes that each dimension of the
real-valued pattern vector is normalized between [0,1].
- class ngclearn.components.BernoulliCell(*args, **kwargs)[source]
A Bernoulli cell that produces spikes by sampling a Bernoulli distribution on-the-fly (to produce data-scaled Bernoulli spike trains).
— Cell Input Compartments: —inputs - input (takes in external signals – should be probabilities w/ values in [0,1])— Cell State Compartments: —key - JAX PRNG key— Cell Output Compartments: —outputs - outputtols - time-of-last-spike- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
batch_size – batch size dimension of this cell (Default: 1)
- advance_state(t)[source]
- reset()[source]
Poisson Cell
This cell takes a real-valued pattern(s) and transforms it on-the-fly to
a spike train where each spike vector is a sample of Poisson spike-train with
a maximum frequency (given in Hertz).
NOTE: this assumes that each dimension of the real-valued pattern vector is
normalized between [0,1] (otherwise, results may not be as expected).
- class ngclearn.components.PoissonCell(*args, **kwargs)[source]
A Poisson cell that samples a homogeneous Poisson process on-the-fly to produce a spike train.
— Cell Input Compartments: —inputs - input (takes in external signals)— Cell State Compartments: —key - JAX PRNG key— Cell Output Compartments: —outputs - outputtols - time-of-last-spike- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
target_freq – maximum frequency (in Hertz) of this Bernoulli spike train (must be > 0.)
batch_size – batch size dimension of this cell (Default: 1)
- advance_state(t, dt)[source]
- reset()[source]
Latency Cell
This cell takes a real-valued pattern(s) and transforms it on-the-fly to a spike train where each spike vector is a sample of a latency (en)coded spike train; higher intensity values will result in a firing time that occurs earlier whereas lower intensity values yield later firing times.
- class ngclearn.components.LatencyCell(*args, **kwargs)[source]
A (nonlinear) latency encoding (spike) cell; produces a time-lagged set of spikes on-the-fly.
— Cell Input Compartments: —inputs - input (takes in external signals)— Cell State Compartments: —targ_sp_times - target-spike-timemask - spike-ordering maskkey - JAX PRNG key— Cell Output Compartments: —outputs - outputtols - time-of-last-spike- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
tau – time constant for model used to calculate firing time (Default: 1 ms)
threshold – sensory input features below this threhold value will fire at final step in time of this latency coded spike train
first_spike_time – time of first allowable spike (ms) (Default: 0 ms)
linearize – should the linear latency encoding scheme be used? (otherwise, defaults to logarithmic latency encoding)
normalize –
normalize the latency code such that final spike(s) occur a pre-specified number of simulation steps “num_steps”? (Default: False)
- Note:
if this set to True, you will need to choose a useful value for the “num_steps” argument (>1), depending on how many steps simulated
clip_spikes – should values under threshold be removed/suppressed? (default: False)
num_steps – number of discrete time steps to consider for normalized latency code (only useful if “normalize” is set to True) (Default: 1)
batch_size – batch size dimension of this cell (Default: 1)
- advance_state(t)[source]
- reset()[source]
Phasor Cell
This cell takes a real-valued pattern(s) and transforms it on-the-fly to a spike train composed of pulses emitted a regular interval.
- class ngclearn.components.PhasorCell(*args, **kwargs)[source]
A phasor cell that emits a pulse at a regular interval.
— Cell Input Compartments: —inputs - input (takes in external signals)— Cell State Compartments: —key - JAX PRNG keyangles - current angle of phasor— Cell Output Compartments: —outputs - output of phasor celltols - time-of-last-spike- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
target_freq – maximum frequency (in Hertz) of this spike train (must be > 0.)
batch_size – batch size dimension of this cell (Default: 1)
- advance_state(t, dt)[source]
- reset()[source]