Neuronal Cells
The neuron (or neuronal cell) represents one of the fundamental building blocks of a biomimetic neural system. These particular objects are meant to perform, per simulated time step, a calculation of output activity values given an internal arrangement of compartments (or sources where signals from other neuronal cell(s) are to be deposited). Typically, a neuron integrates an (ordinary) differential equation, which depends on the type of neuronal cell and dynamics under consideration.
Graded, Real-valued Neurons
This family of neuronal cells adheres to dynamics or performs calculations utilizing graded (real-valued/continuous) values; in other words, they do not produce any discrete signals or action potential values.
The Rate Cell
This cell evolves one set of dynamics over state z (a sort of real-valued
continuous membrane potential). The “electrical” inputs that drive it include
j (non-modulated signals) and j_td (modulated signals), which can be mapped
to bottom-up and top-down pressures (such as those produced by error neurons) if
one is building a strictly hierarchical neural model. Note that the “spikes” zF
emitted are real-valued for the rate-cell and are represented via the application
of a nonlinear activation function (default is the identity) configured by
the user.
- class ngclearn.components.RateCell(*args, **kwargs)[source]
A non-spiking cell driven by the gradient dynamics of neural generative coding-driven predictive processing.
The specific differential equation that characterizes this cell is (for adjusting v, given current j, over time) is:
tau_m * dz/dt = lambda * prior(z) + (j + j_td)where j is the set of general incoming input signals (e.g., message-passed signals)and j_td is taken to be the set of top-down pressure signals— Cell Input Compartments: —j - input pressure (takes in external signals)j_td - input/top-down pressure input (takes in external signals)— Cell State Compartments —z - rate activity— Cell Output Compartments: —zF - post-activation function activity, i.e., fx(z)- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
tau_m – membrane/state time constant (milliseconds)
prior –
a kernel for specifying the type of centered scale-shift distribution to impose over neuronal dynamics, applied to each neuron or dimension within this component (Default: (“gaussian”, 0)); this is a tuple with 1st element containing a string name of the distribution one wants to use while the second value is a leak rate scalar that controls the influence/weighting that this distribution has on the dynamics; for example, (“laplacian, 0.001”) means that a centered laplacian distribution scaled by 0.001 will be injected into this cell’s dynamics ODE each step of simulated time
- Note:
supported scale-shift distributions include “laplacian”, “cauchy”, “exp”, and “gaussian”
act_fx – string name of activation function/nonlinearity to use
output_scale – factor to multiply output of nonlinearity of this cell by (Default: 1.)
integration_type –
type of integration to use for this cell’s dynamics; current supported forms include “euler” (Euler/RK-1 integration) and “midpoint” or “rk2” (midpoint method/RK-2 integration) (Default: “euler”)
- Note:
setting the integration type to the midpoint method will increase the accuray of the estimate of the cell’s evolution at an increase in computational cost (and simulation time)
resist_scale – a scaling factor applied to incoming pressure j (default: 1)
- advance_state(dt)[source]
- reset()[source]
The Error Cell
This cell is (currently) a stateless neuron, i.e., it is not driven by an
underlying differential equation, thus emulating a “fixed-point” error or mismatch
calculation. Variations of the fixed-point error cell depend on the local
distribution assumed over mismatch activities, e.g., Gaussian distribution
yields a Gaussian error cell, which will also change the form of their
internal compartments (typically a target, mu, dtarget, and dmu).
Gaussian Error Cell
This cell is (currently) fixed to be a Gaussian
cell that assumes an identity covariance. Note that this neuronal cell has
several important compartments: in terms of input compartments, target is
for placing the desired target activity level while mu is for placing an
externally produced mean prediction value, while in terms of output
compartments, dtarget is the first derivative with respect to the target
(sometimes used to emulate a top-down pressure/expectation in predictive coding)
and dmu is the first derivative with respect to the mean parameter.
- class ngclearn.components.GaussianErrorCell(*args, **kwargs)[source]
A simple (non-spiking) Gaussian error cell - this is a fixed-point solution of a mismatch signal.
— Cell Input Compartments: —mu - predicted value (takes in external signals)Sigma - predicted covariance (takes in external signals)target - desired/goal value (takes in external signals)modulator - modulation signal (takes in optional external signals)mask - binary/gating mask to apply to error neuron calculations— Cell Output Compartments: —L - local loss function embodied by this celldmu - derivative of L w.r.t. mudSigma - derivative of L w.r.t. Sigmadtarget - derivative of L w.r.t. target- 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)
sigma – initial/fixed value for prediction covariance matrix (𝚺) in multivariate gaussian distribution; Note that if the compartment Sigma is never used, then this cell assumes that the covariance collapses to a constant/fixed sigma
- advance_state(dt)[source]
- reset()[source]
Laplacian Error Cell
This cell is (currently) fixed to be a Laplacian
cell that assumes an identity scale. Note that this neuronal cell has
several important compartments: in terms of input compartments, target is
for placing the desired target activity level while mu is for placing an
externally produced mean prediction value, while in terms of output
compartments, dtarget is the first derivative with respect to the target
(sometimes used to emulate a top-down pressure/expectation in predictive coding)
and dmu is the first derivative with respect to the mean parameter.
- class ngclearn.components.LaplacianErrorCell(*args, **kwargs)[source]
A simple (non-spiking) Laplacian error cell - this is a fixed-point solution of a mismatch/error signal.
— Cell Input Compartments: —shift - predicted shift value (takes in external signals)Scale - predicted scale (takes in external signals)target - desired/goal value (takes in external signals)modulator - modulation signal (takes in optional external signals)mask - binary/gating mask to apply to error neuron calculations— Cell Output Compartments: —L - local loss function embodied by this celldshift - derivative of L w.r.t. shiftdScale - derivative of L w.r.t. Scaledtarget - derivative of L w.r.t. target- 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)
scale – initial/fixed value for prediction scale matrix in multivariate laplacian distribution; Note that if the compartment Scale is never used, then this cell assumes that the scale collapses to a constant/fixed scale
- advance_state(dt)[source]
- reset()[source]
Bernoulli Error Cell
This cell is (currently) fixed to be a (factorized) multivariate Bernoulli cell. Concretely, this cell implements compartments/mechanics to facilitate Bernoulli log likelihood error calculations.
- class ngclearn.components.BernoulliErrorCell(*args, **kwargs)[source]
A simple (non-spiking) Bernoulli error cell - this is a fixed-point solution of a mismatch signal. Specifically, this cell operates as a factorized multivariate Bernoulli distribution.
— Cell Input Compartments: —p - predicted probability (or logits) of positive trial (takes in external signals)target - desired/goal value (takes in external signals)modulator - modulation signal (takes in optional external signals)mask - binary/gating mask to apply to error neuron calculations— Cell Output Compartments: —L - local loss function embodied by this celldp - derivative of L w.r.t. p (or logits, if p = sigmoid(logits))dtarget - derivative of L w.r.t. target- 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)
input_logits – if True, treats compartment p as logits and will apply a sigmoidal link, i.e., _p = sigmoid(p), to obtain the param p for Bern(X=1; p)
- advance_state(dt)[source]
- reset()[source]
Spiking Neurons
These neuronal cells exhibit dynamics that involve emission of discrete action
potentials (or spikes). Typically, such neurons are modeled with multiple
compartments, including at least one for the electrical current j, the
membrane potential v, the voltage threshold thr, and action potential s.
Note that the interactions or dynamics underlying each component might itself
be complex and nonlinear, depending on the neuronal cell simulated (i.e., some
neurons might be running multiple differential equations under the hood).
The Simplified LIF (sLIF) Cell
This cell, which is a simplified version of the leaky integrator (i.e., model
described later below), models dynamics over voltage v and threshold thr
(note that j is further treated as a point-wise current for simplicity).
Importantly, an optional fast form of lateral inhibition can be emulated with
this cell by setting the inhibitory resistance inhibit_R > 0 – this will mean
that the dynamics over v include a term that is equal to a negative hollow
matrix product with the spikes emitted at time t-1 (yielding a recurrent
negative pressure on the membrane potential values at t).
- class ngclearn.components.SLIFCell(*args, **kwargs)[source]
A spiking cell based on a simplified leaky integrate-and-fire (sLIF) model. This neuronal cell notably contains functionality required by the computational model employed by (Samadi et al., 2017, i.e., a surrogate derivative function and “sticky spikes”) as well as the additional incorporation of an adaptive threshold (per unit) scheme. (Note that this particular spiking cell only supports Euler integration of its voltage dynamics.)
— Cell Input Compartments: —j - electrical current input (takes in external signals)— Cell State Compartments: —v - membrane potential/voltage staterfr - (relative) refractory variable statethr - (adaptive) threshold statekey - JAX PRNG key— Cell Output Compartments: —s - emitted binary spikes/action potentialssurrogate - state of surrogate function output signals (currently, the secant LIF estimator)tols - time-of-last-spikeReference:Samadi, Arash, Timothy P. Lillicrap, and Douglas B. Tweed. “Deep learning withdynamic spiking neurons and fixed feedback weights.” Neural computation 29.3(2017): 578-602.- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
tau_m – membrane time constant
resist_m – membrane resistance value
thr – base value for adaptive thresholds (initial condition for per-cell thresholds) that govern short-term plasticity
resist_inh – lateral modulation factor (DEFAULT: 6.); if >0, this will trigger a heuristic form of lateral inhibition via an internally integrated hollow matrix multiplication
thr_persist –
are adaptive thresholds persistent? (Default: False)
- Note:
depending on the value of this boolean variable: True = adaptive thresholds are NEVER reset upon call to reset False = adaptive thresholds are reset to “thr” upon call to reset
thr_gain – how much adaptive thresholds increment by
thr_leak – how much adaptive thresholds are decremented/decayed by
refract_time – relative refractory period time (ms; Default: 1 ms)
rho_b – threshold sparsity factor (Default: 0); note that setting rho_b > 0 will force the adaptive threshold to follow dynamics that ignore thr_grain and thr_leak
sticky_spikes – if True, spike variables will be pinned to action potential value (i.e, 1) throughout duration of the refractory period; this recovers a key setting used by Samadi et al., 2017
thr_jitter – scale of uniform jitter to add to initialization of thresholds
batch_size – batch size dimension of this cell (Default: 1)
- advance_state(t, dt)[source]
- reset()[source]
The IF (Integrate-and-Fire) Cell
This cell (the simple “integrator”) models dynamics over the voltage v. Note that thr is used as the membrane potential threshold and no adaptive threshold mechanics are implemented for this cell model.
(This cell is primarily a faster, convenience formulation that omits the leak element of the LIF.)
- class ngclearn.components.IFCell(*args, **kwargs)[source]
A spiking cell based on integrate-and-fire (IF) neuronal dynamics.
The specific differential equation that characterizes this cell is (for adjusting v, given current j, over time) is:
tau_m * dv/dt = j * Rwhere R is the membrane resistance and v_rest is the resting potentialalso, if a spike occurs, v is set to v_reset— Cell Input Compartments: —j - electrical current input (takes in external signals)— Cell State Compartments: —v - membrane potential/voltage staterfr - (relative) refractory variable statekey - JAX PRNG key— Cell Output Compartments: —s - emitted binary spikes/action potentialss_raw - raw spike signals before post-processing (only if one_spike = True, else s_raw = s)tols - time-of-last-spike- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
tau_m – membrane time constant
resist_m – membrane resistance value (default: 1)
thr – base value for adaptive thresholds that govern short-term plasticity (in milliVolts, or mV; default: -52. mV)
v_rest – membrane resting potential (in mV; default: -65 mV)
v_reset – membrane reset potential (in mV) – upon occurrence of a spike, a neuronal cell’s membrane potential will be set to this value; (default: -60 mV)
refract_time – relative refractory period time (ms; default: 0 ms)
integration_type –
type of integration to use for this cell’s dynamics; current supported forms include “euler” (Euler/RK-1 integration) and “midpoint” or “rk2” (midpoint method/RK-2 integration) (Default: “euler”)
- Note:
setting the integration type to the midpoint method will increase the accuracy of the estimate of the cell’s evolution at an increase in computational cost (and simulation time)
surrogate_type –
type of surrogate function to use for approximating a partial derivative of this cell’s spikes w.r.t. its voltage/current (default: “straight_through”)
- Note:
surrogate options available include: “straight_through” (straight-through estimator), “triangular” (triangular estimator), and “arctan” (arc-tangent estimator)
lower_clamp_voltage – if True, this will ensure voltage never is below the value of v_rest (default: True)
- advance_state(dt, t)[source]
- reset()[source]
The Winner-Take-All (WTAS) Cell
This cell models dynamics over the voltage v as a simple instantaneous
softmax function of the electrical current input, where only a single
spike, which wins the competition across the group of neuronal units
within this component, emits a pulse/spike.
- class ngclearn.components.WTASCell(*args, **kwargs)[source]
A spiking cell based on winner-take-all neuronal dynamics (“WTAS” stands for “winner-take-all-spiking”).
The differential equation for adjusting this specific cell (for adjusting v, given current j, over time) is:
tau_m * dv/dt = j * R ; v_p = softmax(v)where R is membrane resistance and v_p is a voltage probability vector— Cell Input Compartments: —j - electrical current input (takes in external signals)— Cell State Compartments: —v - membrane potential/voltage staterfr - (relative) refractory variable statethr - (adaptive) threshold statekey - JAX PRNG key— Cell Output Compartments: —s - emitted binary spikes/action potentialstols - time-of-last-spike- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
tau_m – membrane time constant
resist_m – membrane resistance value (Default: 1)
thr_base – base value for adaptive thresholds that govern short-term plasticity (in milliVolts, or mV)
thr_gain – increment to be applied to threshold in presence of spike
refract_time – relative refractory period time (ms; Default: 1 ms)
thr_jitter – scale of uniform jitter to add to initialization of thresholds
- advance_state(t, dt)[source]
- reset()[source]
The LIF (Leaky Integrate-and-Fire) Cell
This cell (the “leaky integrator”) models dynamics over the voltage v
and threshold shift thr_theta (a homeostatic variable). Note that thr
is used as a baseline level for the membrane potential threshold while
thrTheta is treated as a form of short-term plasticity (full
threshold is: thr + thrTheta(t)).
- class ngclearn.components.LIFCell(*args, **kwargs)[source]
A spiking cell based on leaky integrate-and-fire (LIF) neuronal dynamics.
The specific differential equation that characterizes this cell is (for adjusting v, given current j, over time) is:
tau_m * dv/dt = (v_rest - v) + j * Rwhere R is the membrane resistance and v_rest is the resting potentialalso, if a spike occurs, v is set to v_reset— Cell Input Compartments: —j - electrical current input (takes in external signals)— Cell State Compartments: —v - membrane potential/voltage staterfr - (relative) refractory variable statethr_theta - homeostatic/adaptive threshold increment statekey - JAX PRNG key— Cell Output Compartments: —s - emitted binary spikes/action potentialss_raw - raw spike signals before post-processing (only if one_spike = True, else s_raw = s)tols - time-of-last-spike- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
tau_m – membrane time constant
resist_m – membrane resistance value (Default: 1)
thr – base value for adaptive thresholds that govern short-term plasticity (in milliVolts, or mV; default: -52. mV)
v_rest – reversal potential or membrane resting potential (in mV; default: -65 mV)
v_reset – membrane reset potential (in mV) – upon occurrence of a spike, a neuronal cell’s membrane potential will be set to this value; (default: -60 mV)
conduct_leak – leak conductance (g_L) value or decay factor applied to voltage leak (Default: 1.); setting this to 0 mV recovers pure integrate-and-fire (IF) dynamics
tau_theta – homeostatic threshold time constant
theta_plus – physical increment to be applied to any threshold value if a spike was emitted
refract_time – relative refractory period time (ms; Default: 5 ms)
one_spike – if True, a single-spike constraint will be enforced for every time step of neuronal dynamics simulated, i.e., at most, only a single spike will be permitted to emit per step – this means that if > 1 spikes emitted, a single action potential will be randomly sampled from the non-zero spikes detected (Default: False)
integration_type –
type of integration to use for this cell’s dynamics; current supported forms include “euler” (Euler/RK-1 integration) and “midpoint” or “rk2” (midpoint method/RK-2 integration) (Default: “euler”)
- Note:
setting the integration type to the midpoint method will increase the accuracy of the estimate of the cell’s evolution at an increase in computational cost (and simulation time)
surrogate_type –
type of surrogate function to use for approximating a partial derivative of this cell’s spikes w.r.t. its voltage/current (default: “straight_through”)
- Note:
surrogate options available include: “straight_through” (straight-through estimator), “triangular” (triangular estimator), “arctan” (arc-tangent estimator), and “secant_lif” (the LIF-specialized secant estimator)
v_min – minimum voltage to clamp dynamics to (Default: None)
- advance_state(dt, t)[source]
- reset()[source]
The Quadratic LIF (Leaky Integrate-and-Fire) Cell
This cell (the quadratic “leaky integrator”) models dynamics over the voltage
v and threshold shift thrTheta (a homeostatic variable). Note that
thr is used as a baseline level for the membrane potential threshold while
thrTheta is treated as a form of short-term plasticity (full threshold
is: thr + thrTheta(t)). The dynamics are driven by a critical voltage value
as well as a voltage scaling factor for membrane potential accumulation over time.
- class ngclearn.components.QuadLIFCell(*args, **kwargs)[source]
A spiking cell based on quadratic leaky integrate-and-fire (LIF) neuronal dynamics. Note that QuadLIFCell is a child of LIFCell and inherits its main set of routines, only overriding its dynamics in advance().
Dynamics can be taken to be governed by the following ODE:
d.Vz/d.t = a0 * (V - V_rest) * (V - V_c) + Jz * R) * (dt/tau_mem)where:
a0 - scaling factor for voltage accumulationV_c - critical voltage (value)— Cell Input Compartments: —j - electrical current input (takes in external signals)— Cell State Compartments: —v - membrane potential/voltage staterfr - (relative) refractory variable statethr_theta - homeostatic/adaptive threshold increment statekey - JAX PRNG key— Cell Output Compartments: —s - emitted binary spikes/action potentialss_raw - raw spike signals before post-processing (only if one_spike = True, else s_raw = s)tols - time-of-last-spike- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
tau_m – membrane time constant
resist_m – membrane resistance value
thr – base value for adaptive thresholds that govern short-term plasticity (in milliVolts, or mV)
v_rest – membrane resting potential (in mV)
v_reset – membrane reset potential (in mV) – upon occurrence of a spike, a neuronal cell’s membrane potential will be set to this value
v_scale – scaling factor for voltage accumulation (v_c)
critical_v – critical voltage value (in mV) (i.e., variable name - a0)
tau_theta – homeostatic threshold time constant
theta_plus – physical increment to be applied to any threshold value if a spike was emitted
refract_time – relative refractory period time (ms; Default: 1 ms)
one_spike – if True, a single-spike constraint will be enforced for every time step of neuronal dynamics simulated, i.e., at most, only a single spike will be permitted to emit per step – this means that if > 1 spikes emitted, a single action potential will be randomly sampled from the non-zero spikes detected
integration_type –
type of integration to use for this cell’s dynamics; current supported forms include “euler” (Euler/RK-1 integration) and “midpoint” or “rk2” (midpoint method/RK-2 integration) (Default: “euler”)
- Note:
setting the integration type to the midpoint method will increase the accuracy of the estimate of the cell’s evolution at an increase in computational cost (and simulation time)
surrogate_type –
type of surrogate function to use for approximating a partial derivative of this cell’s spikes w.r.t. its voltage/current (default: “straight_through”)
- Note:
surrogate options available include: “straight_through” (straight-through estimator), “triangular” (triangular estimator), “arctan” (arc-tangent estimator), and “secant_lif” (the LIF-specialized secant estimator)
v_min – minimum voltage to clamp dynamics to (Default: None)
- advance_state(dt, t)[source]
- reset()[source]
The Adaptive Exponential (AdEx) Integrator Cell
This cell models dynamics over voltage v and a recover variable w (where w
governs the behavior of the action potential of a spiking neuronal cell). In
effect, the adaptive exponential (AdEx) integrate-and-fire model evolves as a
result of two coupled differential equations. (Note that this
cell supports either Euler or midpoint method / RK-2 integration.)
- class ngclearn.components.AdExCell(*args, **kwargs)[source]
The AdEx (adaptive exponential leaky integrate-and-fire) neuronal cell model; a two-variable model. This cell model iteratively evolves voltage “v” and recovery “w”.
The specific pair of differential equations that characterize this cell are (for adjusting v and w, given current j, over time):
tau_m * dv/dt = -(v - v_rest) + sharpV * exp((v - vT)/sharpV) - R_m * w + R_m * jtau_w * dw/dt = -w + (v - v_rest) * awhere w = w + s * (w + b) [in the event of a spike]— Cell Input Compartments: —j - electrical current input (takes in external signals)— Cell State Compartments: —v - membrane potential/voltage statew - recovery variable statekey - JAX PRNG key— Cell Output Compartments: —s - emitted binary spikes/action potentialstols - time-of-last-spikeReferences:Brette, Romain, and Wulfram Gerstner. “Adaptive exponential integrate-and-firemodel as an effective description of neuronal activity.” Journal ofneurophysiology 94.5 (2005): 3637-3642.- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
tau_m – membrane time constant (Default: 15 ms)
resist_m – membrane resistance (Default: 1 mega-Ohm)
tau_w – recover variable time constant (Default: 400 ms)
v_sharpness – slope factor/sharpness constant (Default: 2)
intrinsic_mem_thr – intrinsic membrane threshold (Default: -55 mV)
thr – voltage/membrane threshold (to obtain action potentials in terms of binary spikes) (Default: 5 mV)
v_rest – membrane resting potential (Default: -72 mV)
a – adaptation coupling parameter (Default: 0.1)
b – adaption/recover increment value (Default: 0.75)
v0 – initial condition / reset for voltage (Default: -70 mV)
w0 – initial condition / reset for recovery (Default: 0 mV)
integration_type –
type of integration to use for this cell’s dynamics; current supported forms include “euler” (Euler/RK-1 integration) and “midpoint” or “rk2” (midpoint method/RK-2 integration) (Default: “euler”)
- Note:
setting the integration type to the midpoint method will increase the accuracy of the estimate of the cell’s evolution at an increase in computational cost (and simulation time)
- advance_state(t, dt)[source]
- reset()[source]
The FitzHugh–Nagumo Cell
This cell models dynamics over voltage v and a recover variable w (where w
governs the behavior of the action potential of a spiking neuronal cell). In
effect, the FitzHugh-Nagumo model is a set of two coupled differential equations
that simplify the four differential equation Hodgkin-Huxley (squid axon) model.
A voltage v_thr can be used to extract binary spike pulses. (Note that this
cell supports either Euler or midpoint method / RK-2 integration.)
- class ngclearn.components.FitzhughNagumoCell(*args, **kwargs)[source]
The Fitzhugh-Nagumo neuronal cell model; a two-variable simplification of the Hodgkin-Huxley (squid axon) model. This cell model iteratively evolves voltage “v” and recovery “w” (which represents the combined effects of sodium channel deinactivation and potassium channel deactivation in the Hodgkin-Huxley model).
The specific pair of differential equations that characterize this cell are (for adjusting v and w, given current j, over time):
tau_m * dv/dt = v - (v^3)/3 - w + jtau_w * dw/dt = v + a - b * w— Cell Input Compartments: —j - electrical current input (takes in external signals)— Cell State Compartments: —v - membrane potential/voltage statew - recovery variable statekey - JAX PRNG key— Cell Output Compartments: —s - emitted binary spikes/action potentialstols - time-of-last-spikeReferences:FitzHugh, Richard. “Impulses and physiological states in theoreticalmodels of nerve membrane.” Biophysical journal 1.6 (1961): 445-466.Nagumo, Jinichi, Suguru Arimoto, and Shuji Yoshizawa. “An active pulsetransmission line simulating nerve axon.” Proceedings of the IRE 50.10(1962): 2061-2070.- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
tau_m – membrane time constant
resist_m – membrane resistance value
tau_w – recover variable time constant (Default: 12.5 ms)
alpha – dimensionless recovery variable shift factor “a” (Default: 0.7)
beta – dimensionless recovery variable scale factor “b” (Default: 0.8)
gamma – power-term divisor (Default: 3.)
v0 – initial condition / reset for voltage
w0 – initial condition / reset for recovery
v_thr – voltage/membrane threshold (to obtain action potentials in terms of binary spikes)
spike_reset – if True, once voltage crosses threshold, then dynamics of voltage and recovery are reset/snapped to initial conditions (default: False)
integration_type –
type of integration to use for this cell’s dynamics; current supported forms include “euler” (Euler/RK-1 integration) and “midpoint” or “rk2” (midpoint method/RK-2 integration) (Default: “euler”)
- Note:
setting the integration type to the midpoint method will increase the accuracy of the estimate of the cell’s evolution at an increase in computational cost (and simulation time)
- advance_state(t, dt)[source]
- reset()[source]
The Resonate-and-Fire (RAF) Cell
This cell models dynamics over voltage v and a angular driver state/variable w; these
two variables result in a dampened oscillatory spiking neuronal cell). In effect, the
resonatoe-and-fire (RAF) model (or “resonator”) evolves as a result of two coupled
differential equations. (Note that this cell supports either Euler or RK-2 integration.)
- class ngclearn.components.RAFCell(*args, **kwargs)[source]
The resonate-and-fire (RAF) neuronal cell model; a two-variable model. This cell model iteratively evolves voltage “v” and angular driver “w”.
The specific pair of differential equations that characterize this cell are (for adjusting v and w, given current j, over time):
tau_w * dw/dt = w * b - v * omega + jtau_v * dv/dt = omega * w + v * bwhere omega is angular frequency (Hz) and b is exponential dampening factorNote: injected current j should generally be scaled by tau_w/dt— Cell Input Compartments: —j - electrical current input (takes in external signals)— Cell State Compartments: —v - membrane potential/voltage statew - angular driver variable statekey - JAX PRNG key— Cell Output Compartments: —s - emitted binary spikes/action potentialstols - time-of-last-spikeReferences:Izhikevich, Eugene M. “Resonate-and-fire neurons.” Neural networks 14.6-7 (2001): 883-894.- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
tau_v – membrane/voltage time constant (Default: 1 ms)
tau_w – angular driver variable time constant (Default: 1 ms)
thr – voltage/membrane threshold (to obtain action potentials in terms of binary spikes) (Default: 1 mV)
omega – angular frequency (Default: 10)
dampen_factor – oscillation dampening factor (Default: -1) (“b” in Izhikevich 2001)
v_reset – reset condition for membrane potential (Default: 1 mV)
w_reset – reset condition for angular current driver (Default: 0)
v0 – initial condition for membrane potential (Default: 1 mV)
w0 – initial condition for angular current driver (Default: 0)
resist_v – membrane resistance (Default: 1 mega-Ohm)
integration_type –
type of integration to use for this cell’s dynamics; current supported forms include “euler” (Euler/RK-1 integration) and “midpoint” or “rk2” (midpoint method/RK-2 integration) (Default: “euler”)
- Note:
setting the integration type to the midpoint method will increase the accuracy of the estimate of the cell’s evolution at an increase in computational cost (and simulation time)
- advance_state(t, dt)[source]
- reset()[source]
The Izhikevich Cell
This cell models dynamics over voltage v and a recover variable w (where w
governs the behavior of the action potential of a spiking neuronal cell). In
effect, the Izhikevich model is a set of two coupled differential equations
that simplify the more complex dynamics of the Hodgkin-Huxley model. Note that
this Izhikevich model can be configured to model particular classes of neurons,
including regular spiking (RS), intrinsically bursting (IB), chattering (CH),
fast spiking (FS), low-threshold spiking (LTS), and resonator (RZ) neurons.
(Note that this cell supports either Euler or midpoint method / RK-2 integration.)
- class ngclearn.components.IzhikevichCell(*args, **kwargs)[source]
A spiking cell based on Izhikevich’s model of neuronal dynamics. Note that this a two-variable simplification of more complex multi-variable systems (e.g., Hodgkin-Huxley model). This cell model iteratively evolves voltage “v” and recovery “w”, the last of which represents the combined effects of sodium channel deinactivation and potassium channel deactivation.
The specific pair of differential equations that characterize this cell are (for adjusting v and w, given current j, over time):
tau_m * dv/dt = 0.04 v^2 + 5v + 140 - w + j * R_mtau_w * dw/dt = (v * b - w), where tau_w = 1/a— Cell Input Compartments: —j - electrical current input (takes in external signals)— Cell State Compartments: —v - membrane potential/voltage statew - recovery variable statekey - JAX PRNG key— Cell Output Compartments: —s - emitted binary spikes/action potentialstols - time-of-last-spikeReferences:Izhikevich, Eugene M. “Simple model of spiking neurons.” IEEE Transactionson neural networks 14.6 (2003): 1569-1572.Note: Izhikevich’s constants/hyper-parameters ‘a’, ‘b’, ‘c’, and ‘d’ have been remapped/renamed (see arguments below). Note that the default settings for this component cell is for a regular spiking cell; to recover other types of spiking cells (depending on what neuronal circuitry one wants to model), one can recover specific models with the following particular values:
Intrinsically bursting neurons:v_reset=-55, w_reset=4Chattering neurons:v_reset = -50, w_reset = 2Fast spiking neurons:tau_w = 10Low-threshold spiking neurons:tau_w = 10, coupling_factor = 0.25, w_reset = 2Resonator neurons:tau_w = 10, coupling_factor = 0.26- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
tau_m – membrane time constant (Default: 1 ms)
resist_m – membrane resistance value
v_thr – voltage threshold value to cross for emitting a spike (in milliVolts, or mV) (Default: 30 mV)
v_reset – voltage value to reset to after a spike (in mV) (Default: -65 mV), i.e., ‘c’
tau_w – recovery variable time constant (Default: 50 ms), i.e., 1/’a’
w_reset – recovery value to reset to after a spike (Default: 8), i.e., ‘d’
coupling_factor – degree to which recovery is sensitive to any subthreshold fluctuations of voltage (Default: 0.2), i.e., ‘b’
v0 – initial condition / reset for voltage (Default: -65 mV)
w0 – initial condition / reset for recovery (Default: -14)
integration_type –
type of integration to use for this cell’s dynamics; current supported forms include “euler” (Euler/RK-1 integration) and “midpoint” or “rk2” (midpoint method/RK-2 integration) (Default: “euler”)
- Note:
setting the integration type to the midpoint method will increase the accuracy of the estimate of the cell’s evolution at an increase in computational cost (and simulation time)
- advance_state(t, dt)[source]
- reset()[source]
The Hodgkin-Huxley Cell
This cell models dynamics over voltage v and three channels/gates (related to
potassium and sodium activation/inactivation). This sophisticated cell system is,
as a result, a set of four coupled differential equations and is driven by an appropriately configured set of biophysical constants/coefficients (default values of which have been set according to relevant source work).
(Note that this cell supports Euler, midpoint / RK-2 integration, or RK-4 integration.)
- class ngclearn.components.HodgkinHuxleyCell(*args, **kwargs)[source]
A spiking cell based the Hodgkin-Huxley (H-H) 1952 set of dynamics for describing the ionic mechanisms that underwrite the initiation and propagation of action potentials within a (giant) squid axon.
The four differential equations for adjusting this specific cell (for adjusting v, given current j, over time) are:
tau_v dv/dt = j - g_Na * m^3 * h * (v - v_Na) - g_K * n^4 * (v - v_K) - g_L * (v - v_L)dn/dt = alpha_n(v) * (1 - n) - beta_n(v) * ndm/dt = alpha_m(v) * (1 - m) - beta_m(v) * mdh/dt = alpha_h(v) * (1 - h) - beta_h(v) * hwhere alpha_x(v) and beta_x(v) are functions that produce relevant biophysical constant valuesdepending on which gate/channel is being probed (i.e., x = n or m or h)— Cell Input Compartments: —j - electrical current input (takes in external signals)— Cell State Compartments: —v - membrane potential/voltage staten - dimensionless probabilities for potassium channel subunit activationm - dimensionless probabilities for sodium channel subunit activationh - dimensionless probabilities for sodium channel subunit inactivationkey - JAX PRNG key— Cell Output Compartments: —s - emitted binary spikes/action potentialstols - time-of-last-spikeReferences:Hodgkin, Alan L., and Andrew F. Huxley. “A quantitative description of membrane current and its application toconduction and excitation in nerve.” The Journal of physiology 117.4 (1952): 500.Kistler, Werner M., Wulfram Gerstner, and J. Leo van Hemmen. “Reduction of the Hodgkin-Huxley equations to asingle-variable threshold model.” Neural computation 9.5 (1997): 1015-1045.- Parameters:
name – the string name of this cell
n_units – number of cellular entities (neural population size)
tau_v – membrane time constant (Default: 1 ms)
resist_m – membrane resistance value
v_Na – sodium reversal potential
v_K – potassium reversal potential
v_L – leak reversal potential
g_Na – sodium (Na) conductance per unit area
g_K – potassium (K) conductance per unit area
g_L – leak conductance per unit area
thr – voltage/membrane threshold (to obtain action potentials in terms of binary spikes/pulses)
spike_reset – if True, once voltage crosses threshold, then dynamics of voltage and recovery are reset/snapped to v_reset which has a default value of 0 mV (Default: False)
v_reset – voltage value to reset to after a spike (in mV) (Default: 0 mV)
integration_type –
type of integration to use for this cell’s dynamics; current supported forms include “euler” (Euler/RK-1 integration), “midpoint” or “rk2” (midpoint method/RK-2 integration), or “rk4” (RK-4 integration) (Default: “euler”)
- Note:
setting the integration type to the midpoint or rk4 method will increase the accuracy of the estimate of the cell’s evolution at an increase in computational cost (and simulation time)
- advance_state(t, dt)[source]
- reset()[source]