IF#
Introduction#
The Integrate-and-Fire (IF) neuron model is a simple but effective mathematical model used to simulate the behavior of individual neurons in the brain. IF model assumes that a neuron integrates incoming electrical signals from other neurons and fires a spike of electrical activity when its membrane potential reaches a certain threshold value. The IF model has been widely used in computational neuroscience to understand the dynamics of single neurons and to build larger-scale neural networks.
How does it work?#
The Integrate-and-Fire (IF) neuron model is a simplified version of the LIF model that only considers the neuron’s membrane potential crossing a fixed threshold. In this model, the membrane potential is assumed to increase linearly with the input current, and once it reaches the threshold value, the neuron fires a spike and the membrane potential is reset to the resting potential. The dynamics of the IF model can be described by the following equations:
$$ \begin{align*} \ &\tau_m\frac{du}{dt}\ = RI(t) &\text{if }\quad u(t) \leq u_{th}\ \end{align*} $$
$$ \begin{align*} &u(t) = u_{rest} &\text{otherwise}\ \ \end{align*} $$
where $u(t)$ is the membrane potential at time $t$, $u_{rest}$ is the resting potential, $u_{th}$ is the threshold potential, $R$ is the membrane resistance, $I(t)$ is the input current, and $\tau_m$ is the membrane time constant. If the membrane potential reaches the threshold value, a spike is emitted and the membrane potential is reset to the resting potential. The IF model is computationally efficient and can be used for large-scale simulations, but it lacks the ability to accurately model the neuron’s subthreshold behavior and the effect of synaptic inputs on the membrane potential.
Strengths:#
Weaknesses:#
Usage#
IF Population model can be used by given code:
from synapticflow.network import neural_populations
model = neural_populations.IFPopulation(n=10)
Then you can stimulate each time step by calling forward function:
model.forward(torch.tensor([10 for _ in range(model.n)]))
All available attributes like spike trace and membrane potential is 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.
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.