Izhikevich¶
- class Izhikevich(shape: tuple[int, ...] | int, step_time: float, *, rest_v: float, crit_v: float, affinity: float, reset_v: float, thresh_v: float, refrac_t: float, tc_membrane: float, tc_adaptation: float | tuple[float, ...], voltage_coupling: float | tuple[float, ...], spike_increment: float | tuple[float, ...], resistance: float = 1.0, batch_size: int = 1, batch_reduction: Callable[[Tensor, tuple[int, ...]], Tensor] | None = None)[source]¶
Bases:
AdaptiveCurrentMixin,VoltageMixin,SpikeRefractoryMixin,InfernoNeuronSimulation of Izhikevich (adaptive quadratic) neuron dynamics.
Implemented as an approximation using Euler’s method.
\[\begin{split}\begin{align*} V_m(t + \Delta t) &= \frac{\Delta t}{\tau_m} \left[ a \left(V_m(t) - V_\text{rest}\right)\left(V_m(t) - V_\text{crit}\right) + R_mI(t) \right] + V_m(t) \\ I(t) &= I_x(t) - \sum_k w_k(t) \\ w_k(t + \Delta t) &= \frac{\Delta t}{\tau_k}\left[ b_k \left[ V_m(t) - V_\text{rest} \right] - w_k(t) \right] + w_k(t) \end{align*}\end{split}\]If a spike was generated at time \(t\), then.
\[\begin{split}\begin{align*} V_m(t) &\leftarrow V_\text{reset} \\ w_k(t) &\leftarrow w_k(t) + d_k \end{align*}\end{split}\]- Parameters:
shape (tuple[int, ...] | int) – shape of the group of neurons being simulated.
step_time (float) – length of a simulation time step, \(\Delta t\), in \(\text{ms}\).
rest_v (float) – membrane potential difference at equilibrium, \(V_\text{rest}\), in \(\text{mV}\).
crit_v (float) – membrane potential difference at which potential naturally increases, \(V_\text{crit}\), in \(\text{mV}\).
affinity (float) – controls the strength of the membrane potential’s drift towards \(V_\text{rest}\) and away from \(V_\text{crit}\), \(a\), unitless.
reset_v (float) – membrane voltage after an action potential is generated, \(V_\text{reset}\), in \(\text{mV}\).
thresh_v (float) – membrane voltage at which action potentials are generated, in \(\text{mV}\).
refrac_t (float) – length the absolute refractory period, in \(\text{ms}\).
tc_membrane (float) – time constant of exponential decay for membrane voltage, \(\tau_m\), in \(\text{ms}\).
tc_adaptation (float | tuple[float, ...]) – time constant of exponential decay for threshold adaptations, \(\tau_k\), in \(\text{ms}\).
voltage_coupling (float | tuple[float, ...]) – strength of coupling to membrane voltage, \(b_k\), in \(\mu\text{S}\).
spike_increment (float | tuple[float, ...]) – amount by which the adaptive current is increased after a spike, \(d_k\), in \(\text{nA}\).
resistance (float, optional) – resistance across the cell membrane, \(R_m\), in \(\text{M}\Omega\). Defaults to
1.0.batch_size (int, optional) – size of input batches for simulation. Defaults to
1.
Note
batch_reductioncan be one of the functions in PyTorch including but not limited totorch.sum(),torch.mean(), andtorch.amax(). A custom function with similar behavior can also be passed in. Like with the included function, it should not keep the original dimensions by default.See also
For more details and references, visit Izhikevich (Adaptive Quadratic) in the zoo.
- clear(keep_adaptations: bool = True, **kwargs) None[source]¶
Resets neurons to their resting state.
- Parameters:
keep_adaptations (bool, optional) – if learned adaptations should be preserved. Defaults to
True.
- forward(inputs: Tensor, adapt: bool | None = None, refrac_lock: bool = True, **kwargs) Tensor[source]¶
Runs a simulation step of the neuronal dynamics.
- Parameters:
inputs (torch.Tensor) – presynaptic currents, \(I-x(t)\), in \(\text{nA}\).
adapt (bool | None, optional) – if adaptations should be updated based on this step. Defaults to
None.refrac_lock (bool, optional) – if membrane voltages should be fixed while in the refractory period. Defaults to
True.
- Returns:
if the corresponding neuron generated an action potential.
- Return type:
Note
When
adaptis set to None, adaptations will be updated when the neuron is in training mode but not when it is in evaluation mode.