Quadratic Integrate and Fire (QIF)¶
Implementation of the Quadratic Integrate and Fire (QIF) neuron model in phase representation.
The QIF extends the LIF and inherits its spike handling (spike_condition, input_spike, reset_spiked) but replaces the voltage dynamics with quadratic ones.
The standard QIF dynamics in voltage space are:
To avoid the divergence of \(V \to \infty\) at spike time, the model operates in phase space via the coordinate transform following Klos and Memmersheimer:
Free Dynamics (phase representation)
Transition Condition
Jumps at Transition
Where
- \(\varphi \in \mathbb{R}^N\) is the phase variable (bounded in \([0, 1]\)),
- \(I \in \mathbb{R}^N\) is the synaptic current,
- \(I_c \in \mathbb{R}^N\) is the bias current,
- \(\tau_\text{syn}\) and \(\tau_\text{mem}\) are the time constants,
- \(W \in \mathbb{R}^{(N+K) \times N}\) is the synaptic weight matrix with number of neurons \(N\) and input size \(K\).
The threshold and reset are fixed at \(\vartheta = 1\) and \(\varphi_\text{reset} = 0\) respectively.
eventax.neuron_models.QIF ¶
Bases: LIF
Quadratic integrate-and-fire neuron in phase representation.
Extends LIF with quadratic voltage dynamics
reformulated via the phase variable \(\varphi =
\frac{1}{\pi}\arctan\!\left(\frac{V}{\pi}\right) + \frac{1}{2}\).
Source code in eventax/neuron_models/qif.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
Parameters¶
The QIF accepts the same parameters as the LIF except that thresh, vreset, and reset_grad_preserve are fixed internally and not exposed.
| Parameter | Description | Default |
|---|---|---|
n_neurons |
Number of neurons in the layer. | — |
in_size |
Number of input connections. | — |
tmem |
Membrane time constant \(\tau_\text{mem}\). | — |
tsyn |
Synaptic time constant \(\tau_\text{syn}\). | — |
wmask |
Binary mask for the weight matrix, shape \((N+K) \times N\). | — |
dtype |
JAX dtype for all computations. | jnp.float32 |
Weight initialisation¶
Same as LIF — Weight initialisation.
| Parameter | Description | Default |
|---|---|---|
init_weights |
If given, used directly as \(W\). | None |
wmean |
Mean for random weight initialisation. | 0.0 |
wlim |
Uniform half-range for random weights. | None |
fan_in_mode |
Fan-in scaling mode. | None |
init_bias |
If given, used directly as \(I_c\). | None |
bmean |
Mean for random bias initialisation. | 0.0 |
blim |
Uniform half-range for random biases. | None |
State layout¶
The state array y has shape (n_neurons, 2):
| Channel | Index | Description |
|---|---|---|
| \(\varphi\) | y[:, 0] |
Phase variable (bounded in \([0, 1]\)) |
| \(I\) | y[:, 1] |
Synaptic current |
Initial state: \(\varphi = 0.5\), \(I = 0\).
Note
The internal state uses the phase variable \(\varphi\), not the voltage \(V\). Use observe to convert back to voltage space.
Trainable fields¶
| Field | Shape | Description |
|---|---|---|
weights |
\((N+K) \times N\) | Connection weight matrix \(W\) |
ic |
\((N,)\) | Bias current \(I_c\) |
Methods¶
init_state¶
Return initial state with \(\varphi = 0.5\) and \(I = 0\).
Source code in eventax/neuron_models/qif.py
52 53 54 55 56 | |
Returns state of shape (n_neurons, 2) with \(\varphi = 0.5\) (corresponding to \(V = 0\)) and \(I = 0\).
dynamics¶
Compute the QIF phase-space ODE derivatives.
Source code in eventax/neuron_models/qif.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
Implements the QIF free dynamics in phase space. See the equations at the top of this page.
observe¶
Map phase \(\varphi\) back to voltage via \(V = \pi\tan\!\bigl(\pi(\varphi - \tfrac{1}{2})\bigr)\).
Source code in eventax/neuron_models/qif.py
75 76 77 78 79 80 81 82 83 | |
Maps the phase variable back to voltage space via the inverse transform:
Returns an array of shape (n_neurons, 2) where channel 0 is now the voltage \(V\) instead of the phase \(\varphi\), and channel 1 is the synaptic current \(I\) (unchanged).
Inherited methods¶
The following methods are inherited from LIF without modification:
spike_condition— triggers when \(\varphi\) crosses \(\vartheta = 1\).input_spike— adds \(W_{n,m}\) to the synaptic current of target neurons.reset_spiked— resets \(\varphi\) to \(0\) viajnp.where(reset_grad_preserve=False).