LIF#
Introduction#
The Leaky Integrate-and-Fire (LIF) neuron model is one of the simplest and most commonly used neuron models in computational neuroscience. The LIF model consists of a simple linear differential equation that describes the neuron’s membrane potential, which integrates incoming synaptic inputs until it reaches a threshold, at which point the neuron “fires” a spike and resets its membrane potential. Despite its simplicity, the LIF model has been shown to accurately capture many essential aspects of real neural behavior, such as spike timing and synchronization, and is widely used in both theoretical and experimental neuroscience. As such, the LIF model is a valuable tool for studying the behavior of neurons and neural networks in the brain.
How does it work?#
LIF stands for Leaky Integrate-and-Fire neuron model. It is a simplified version of the ALIF model. LIF neuron integrates incoming input current $I(t)$ over time and generates a spike when the membrane potential $u(t)$ reaches a certain threshold $u_{th}$. Similar to the ALIF model, the LIF neuron has a resting potential $u_{rest}$ and a membrane time constant $\tau_m$. However, the LIF neuron does not have the adaptation term and the threshold reset mechanism that the ALIF model has. Therefore, the membrane potential $u(t)$ of the LIF neuron obeys the following differential equation:
$$ \begin{align*} \ &\tau_m\frac{du}{dt}\ = -[u(t) - u_{rest}] + RI(t) &\text{if }\quad u(t) \leq u_{th}\ \end{align*} $$
If the membrane potential $u(t)$ reaches the threshold $u_{th}$, the neuron generates a spike and the membrane potential is reset to the resting potential $u_{rest}$. This is modeled as:
$$ \begin{align*} &u(t) = u_{rest} &\text{otherwise}\ \ \end{align*} $$
The LIF neuron model is widely used in computational neuroscience and is computationally efficient due to its simplicity. However, it does not capture the dynamics of spiking behavior as accurately as more complex models like ALIF.
Strengths:#
Weaknesses:#
Usage#
LIF Population model can be used by the given code:
from synapticflow.network import neural_populations
model = neural_populations.LIFPopulation(n=10)
Then you can stimulate each time step by calling the forward function:
model.forward(torch.tensor([10 for _ in range(model.n)]))
All available attributes like spike trace and membrane potential are available by model instance:
print(model.s) # Model spike trace
print(model.v) # Model membrane potential
And in the same way, you can use the visualization file to draw plots of the obtained answer:
Parameters:#
n (int, optional) - Number of neurons in this layer.
shape (Iterable[int], optional) - Shape of the input tensor to the layer.
spike_trace (bool, optional) - Indicates whether to use synaptic traces or not.
additive_spike_trace (bool, optional) - If true, uses additive spike traces instead of multiplicative ones.
tau_s (float or torch.Tensor, optional) - Decay time constant for spike trace. Default : 10
threshold (float or torch.Tensor, optional) - The spike threshold of the neuron.
rest_pot (float or torch.Tensor, optional) - The resting potential of the neuron.
reset_pot (float or torch.Tensor, optional) - The reset potential of the neuron.
refrac_length (float or torch.Tensor, optional) - The refractory period length of the neuron in timesteps.
dt (float, optional) - The time step length.
lower_bound (float, optional) - Minimum value for the membrane potential of the neuron.
sum_input (bool, optional) - If true, sums input instead of averaging it.
trace_scale (float, optional) - Scaling factor for the synaptic traces.
is_inhibitory (bool, optional) - Indicates whether the neuron is inhibitory or not.
R (Union[float, torch.Tensor], optional) - The time constant of the neuron voltage decay.
learning (bool, optional) - Indicates whether the neuron should update its weights during training.