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: Any, **kwargs: Any)[source]

A Bernoulli cell that produces Bernoulli-distributed spikes on-the-fly.

Parameters:
  • name – the string name of this cell

  • n_units – number of cellular entities (neural population size)

  • key – PRNG key to control determinism of any underlying synapses associated with this cell

  • useVerboseDict – triggers slower, verbose dictionary mode (Default: False)

advance_state(t, dt, **kwargs)[source]
verify_connections()[source]
reset(**kwargs)[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: Any, **kwargs: Any)[source]

A Poisson cell that produces approximately Poisson-distributed spikes on-the-fly.

Parameters:
  • name – the string name of this cell

  • n_units – number of cellular entities (neural population size)

  • max_freq – maximum frequency (in Hertz) of this Poisson spike train (must be > 0.)

  • key – PRNG key to control determinism of any underlying synapses associated with this cell

  • useVerboseDict – triggers slower, verbose dictionary mode (Default: False)

advance_state(t, dt, **kwargs)[source]
verify_connections()[source]
reset(**kwargs)[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: Any, **kwargs: Any)[source]

A (nonlinear) latency encoding (spike) cell; produces a time-lagged set of spikes on-the-fly.

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

  • num_steps – number of discrete time steps to consider for normalized latency code (only useful if “normalize” is set to True) (Default: 1)

  • key – PRNG key to control determinism of any underlying synapses associated with this cell

  • useVerboseDict – triggers slower, verbose dictionary mode (Default: False)

advance_state(t, dt, **kwargs)[source]
verify_connections()[source]
reset(**kwargs)[source]