在解析代码之前,我们现在看一下SRM模型。

第一个函数表示一个spike应该具有的形状。其中tf是上一个发放脉冲的时间。
第二个函数中Iext描述的是所有突触前脉冲时间对膜电位产生的影响。
第三个函数应该很好理解,就是一个静息电位的电压。
早期的文章里SRM模型被描述成:

第二项就是前任神经元对本神经元对影响。
第三项比较特殊
一般的SNN模型里强行规定在本神经元射了之后的任何输入刺激均直接舍弃,但是这样的话显得太暴力了,不符合生物运行的规律,于是G大爷给这个贤者时间的消退也安排了函数。简单来说,在贤者时间中,收到的刺激会反应在膜电位上,但是对于膜电位的影响非常小,可能不及射前的百分之一。并且,贤者时间导致神经元的敏感度降低会指数降低,也就是说,神经元的敏感度会指数回升!
总的来说,第一项贴上了标准的发射过程 电位,第二项表示在射之前收到的所有刺激对电位的影响,第三项表示射之后(贤者时间)收到的所有刺激对电位的影响。
至于简化版SRM0神经元。

可以看出就是早期的SRM模型把最后一项,在不应期也会对刺激产生反应的部分去掉了。
形式是这样的。
其中,

eta函数图像。


eps函数图像:

上代码吧,代码看的更清楚一些。
import numpy as np
import functools
class SRM:
""" SRM_0 (Spike Response Model) """
#def __init__(self, neurons, threshold, t_current, t_membrane, eta_reset, simulation_window_size=100, verbose=False):
def __init__(self, neurons, threshold=1, t_current=0.3, t_membrane=20, eta_reset=5, simulation_window_size=100, verbose=True):
"""
Neurons can have different threshold, t_current, t_membrane and eta_resets: Set those variables to 1D np.arrays of all the same size.
:param neurons: Number of neurons
:param threshold: Spiking threshold
:param t_current: Current-time-constant (:math:`t_s`) #电流时间常数
:type t_current: Float or Numpy Float Array
:param t_membrane: Membrane-time-constant (t_m) #细胞膜时间常数
:param eta_reset: Reset constant
:param simulation_window_size: Only look at the n last spikes #滑动窗口
:param verbose: Print verbose output to the console
:return: ``None``
"""
# Check user input
try: neurons = int(neurons)
except: raise ValueError("Variable neurons should be int or convertible to int")
# threshold, t_current, t_membrane, and eta_reset are all vector
threshold = np.array(threshold)
t_current = np.array(t_current)
t_membrane = np.array(t_membrane)
eta_reset = np.array(eta_reset)
if not(threshold.shape == t_current.shape == t_membrane.shape == eta_reset.shape): #阈值 输入电流时序 细胞膜时序 重置时间常数+
raise ValueError("Vector of threshhold, t_current, t_membrane, and eta_reset must be same size")
try: simulation_window_size = int(simulation_window_size)
except: raise ValueError("Variable simulation_window_size should be int or convertible to int")
self.neurons = neurons
self.threshold = threshold
self.t_current = t_current
self.t_membrane = t_membrane
self.eta_reset = eta_reset
self.simulation_window_size = simulation_window_size
self.verbose = verbose
self.cache = {
}
self.cache['last_t'

本文解析了SRM模型,包括spike形状函数、突触前影响、静息电位、贤者时间的消退过程,并介绍了简化版SRM0模型的区别。通过数学公式和代码实例展示了如何计算电位变化。
最低0.47元/天 解锁文章
1899

被折叠的 条评论
为什么被折叠?



