ngclearn.components.input_encoders package

Submodules

ngclearn.components.input_encoders.TTFSCell module

class ngclearn.components.input_encoders.TTFSCell.TTFSCell(*args, **kwargs)[source]

Bases: JaxComponent

A time-to-first-spike (TTFS) iterative encoder component. This input encoder converts a real-valued batch input vectors into sparse temporal spike trains, using either exponential or logarithmic latency mapping schemes. Units within this encoder group will only fire once within a spike train (before reset/clearing).

— Cell Input Compartments: —
inputs - input (takes in external signals)
— Cell State Compartments: —
key - JAX PRNG key
has_fired - boolean vector denoting which units have fired thus far
target_spike_times - tracks targeted spike times
refractory_counter - refactory variable to ensure units only fire once
— Cell Output Compartments: —
outputs - output (binary spike train matrix output at the current time step t)
tols - time-of-last-spike
Args:

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)

num_steps: number of total time steps of simulation to consider

tau_ref: ttfs time constant

latency_mode: which type of latency mapping function to apply (Default: “exponential”);

“exponential” triggers exponential-latency mapping while “logarithmic” triggers logarithmic-latency mapping

advance_state(t, dt)[source]
classmethod help()[source]
reset()[source]

ngclearn.components.input_encoders.bernoulliCell module

class ngclearn.components.input_encoders.bernoulliCell.BernoulliCell(*args, **kwargs)[source]

Bases: JaxComponent

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 - output
tols - 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]
classmethod help()[source]
reset()[source]

ngclearn.components.input_encoders.ganglionCell module

class ngclearn.components.input_encoders.ganglionCell.RetinalGanglionCell(*args, **kwargs)[source]

Bases: JaxComponent

A group of retinal ganglion cell that sense input stimuli and send out filtered signals (as output). Note that these simulated cells employ internal generalized filters based on either Gaussian or difference-of-Gaussian kernels) to recover historical receptive field processing effects.

— Cell Input Compartments: —
inputs - input (takes in external signals)
— Cell State Compartments: —
filter - filter (function applied to input)
— Cell Output Compartments: —
outputs - output
Parameters:
  • name – the string name of this cell

  • filter_type – string name of filter function (Default: identity) :Note: supported filters include “gaussian”, “difference_of_gaussian”

  • sigma – standard deviation of (gaussian) kernel

  • area_shape – shape of receptive field area of ganglion cells in this module (all together)

  • n_cells – number of ganglion cells in this module

  • patch_shape – shape of each ganglion cell’s receptive field area

  • step_shape – the non-overlapping area between each pair (two) of ganglion cells

  • batch_size – batch size dimension of this cell/module (Default: 1)

advance_state(t)[source]
classmethod help()[source]
reset()[source]

ngclearn.components.input_encoders.latencyCell module

class ngclearn.components.input_encoders.latencyCell.LatencyCell(*args, **kwargs)[source]

Bases: JaxComponent

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-time
mask - spike-ordering mask
key - JAX PRNG key
— Cell Output Compartments: —
outputs - output
tols - 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]
calc_spike_times()[source]
classmethod help()[source]
reset()[source]

ngclearn.components.input_encoders.phasorCell module

class ngclearn.components.input_encoders.phasorCell.PhasorCell(*args, **kwargs)[source]

Bases: JaxComponent

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 key
angles - current angle of phasor
— Cell Output Compartments: —
outputs - output of phasor cell
tols - 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]
classmethod help()[source]
reset()[source]
validate(dt=None, **validation_kwargs)[source]

ngclearn.components.input_encoders.poissonCell module

class ngclearn.components.input_encoders.poissonCell.PoissonCell(*args, **kwargs)[source]

Bases: JaxComponent

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 - output
tols - 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]
classmethod help()[source]
reset()[source]

Module contents