LIF模型

博客介绍了脉冲神经元相关知识,包括关键词如Leaky(泄露)、Intergrate(集成)、Fired(激发)的含义,还阐述了模型中电压随时间指数稳定到平衡电压的方程,最后给出Python代码,设置了神经元平衡电压、静息电位和发放阈值等参数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

关键词

Leaky(泄露): 表示如果神经元输入只有一个,且不足以让膜电势超过阈值时,由于细胞膜不断进行膜内外离子交换,膜电势会自动发生泄露逐渐回落到静息状态;
Intergrate(集成): 表示神经元会接收所有与该神经元相连的轴突末端发送来的脉冲,并将所接收的所有脉冲信号进行集成(求和);
Fired(激发): 表示当膜电势超过阈值时,神经元会发送脉冲,同时膜电位回落至静息电位Vreset。


模型

 解得

这里c是任意常数, 控制指数下降速率, 越小v(t) 越快指数变化到a,分析这个方程可以看到,初始时t=0时刻v=a-c,其中c取恰当的值就可以使a-c等于脉冲神经元初始时刻电压,当t=∞时v=a,该方程控制了电压v随时间指数稳定到平衡电压a

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。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

2ephyr

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值