关键词
Leaky(泄露): 表示如果神经元输入只有一个,且不足以让膜电势超过阈值时,由于细胞膜不断进行膜内外离子交换,膜电势会自动发生泄露逐渐回落到静息状态;
Intergrate(集成): 表示神经元会接收所有与该神经元相连的轴突末端发送来的脉冲,并将所接收的所有脉冲信号进行集成(求和);
Fired(激发): 表示当膜电势超过阈值时,神经元会发送脉冲,同时膜电位回落至静息电位Vreset。
模型
解得
这里是任意常数, 控制指数下降速率, 越小 越快指数变化到,分析这个方程可以看到,初始时t=0时刻v=,其中取恰当的值就可以使等于脉冲神经元初始时刻电压,当t=∞时v=,该方程控制了电压v随时间指数稳定到平衡电压。
Python代码
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(5, 4))
ax = plt.subplot(111)
# Function that runs the simulation
# tau: time constant (in ms)
# t0, t1, t2: time of three input spikes
# w: input synapse weight
# threshold: threshold value to produce a spike
# reset: reset value after a spike
def LIF(tau=10, t0=20, t1=30, t2=35, w=0.8, threshold=1.0, reset=0.0):
# Spike times, keep sorted because it's more efficient to pop the last value off the list
times = [t0, t1, t2]
times.sort(reverse=True)
# set some default parameters
duration = 100 # total time in ms
dt = 0.1 # timestep in ms
alpha = np.exp(-dt / tau) # this is the factor by which V decays each time step
V_rec = [] # list to record membrane potentials
V = 0.0 # initial membrane potential
T = np.arange(np.round(duration / dt)) * dt # array of times
spikes = [] # list to store spike times
# run the simulation
# plot everything (T is repeated because we record V twice per loop)
ax.clear()
for t in times:
ax.axvline(t, ls=':', c='b')
for t in T:
V_rec.append(V) # record
V *= alpha # integrate equations
if times and t > times[-1]: # if there has been an input spike
V +=w
times.pop() # remove that spike from list
V_rec.append(V) # record V before the reset so we can see the spike
if V > threshold: # if there should be an output spike
V = reset
spikes.append(t)
ax.plot(np.repeat(T, 2), V_rec, '-k', lw=2)
for t in spikes:
ax.axvline(t, ls='--', c='r')
ax.axhline(threshold, ls='--', c='g')
ax.set_xlim(0, duration)
ax.set_ylim(-1, 2)
ax.set_xlabel('Time (ms)')
ax.set_ylabel('Voltage')
plt.tight_layout()
plt.show()
LIF()
绿色虚线表示发放阈值,黑色为神经元电压,蓝色虚线表示神经元接收到输入脉冲的时刻,红色虚线表示神经发放了一个脉冲。代码里设置神经元平衡电压为0,静息电位为0,发放阈值为1。