STDP_Song2000#
- class brainpy.dyn.STDP_Song2000(pre, delay, syn, comm, out, post, tau_s=16.8, tau_t=33.7, A1=0.96, A2=0.53, W_max=None, W_min=None, out_label=None, name=None, mode=None)[source]#
Spike-time-dependent plasticity proposed by (Song, et. al, 2000).
This model filters the synaptic currents according to the variables: \(w\).
\[I_{syn}^+(t) = I_{syn}^-(t) * w\]where \(I_{syn}^-(t)\) and \(I_{syn}^+(t)\) are the synaptic currents before and after STDP filtering, \(w\) measures synaptic efficacy because each time a presynaptic neuron emits a pulse, the conductance of the synapse will increase w.
The dynamics of \(w\) is governed by the following equation:
\[\begin{split}\begin{aligned} \frac{dw}{dt} & = & -A_{post}\delta(t-t_{sp}) + A_{pre}\delta(t-t_{sp}), \\ \frac{dA_{pre}}{dt} & = & -\frac{A_{pre}}{\tau_s} + A_1\delta(t-t_{sp}), \\ \frac{dA_{post}}{dt} & = & -\frac{A_{post}}{\tau_t} + A_2\delta(t-t_{sp}), \\ \end{aligned}\end{split}\]where \(t_{sp}\) denotes the spike time and \(A_1\) is the increment of \(A_{pre}\), \(A_2\) is the increment of \(A_{post}\) produced by a spike.
Here is an example of the usage of this class:
import brainpy as bp import brainpy.math as bm class STDPNet(bp.DynamicalSystem): def __init__(self, num_pre, num_post): super().__init__() self.pre = bp.dyn.LifRef(num_pre) self.post = bp.dyn.LifRef(num_post) self.syn = bp.dyn.STDP_Song2000( pre=self.pre, delay=1., comm=bp.dnn.EventCSRLinear(bp.conn.FixedProb(1, pre=self.pre.num, post=self.post.num), weight=bp.init.Uniform(max_val=0.1)), syn=bp.dyn.Expon.desc(self.post.varshape, tau=5.), out=bp.dyn.COBA.desc(E=0.), post=self.post, tau_s=16.8, tau_t=33.7, A1=0.96, A2=0.53, ) def update(self, I_pre, I_post): self.syn() self.pre(I_pre) self.post(I_post) conductance = self.syn.refs['syn'].g Apre = self.syn.refs['pre_trace'].g Apost = self.syn.refs['post_trace'].g current = self.post.sum_inputs(self.post.V) return self.pre.spike, self.post.spike, conductance, Apre, Apost, current, self.syn.comm.weight duration = 300. I_pre = bp.inputs.section_input([0, 30, 0, 30, 0, 30, 0, 30, 0, 30, 0, 30, 0], [5, 15, 15, 15, 15, 15, 100, 15, 15, 15, 15, 15, duration - 255]) I_post = bp.inputs.section_input([0, 30, 0, 30, 0, 30, 0, 30, 0, 30, 0, 30, 0], [10, 15, 15, 15, 15, 15, 90, 15, 15, 15, 15, 15, duration - 250]) net = STDPNet(1, 1) def run(i, I_pre, I_post): pre_spike, post_spike, g, Apre, Apost, current, W = net.step_run(i, I_pre, I_post) return pre_spike, post_spike, g, Apre, Apost, current, W indices = bm.arange(0, duration, bm.dt) pre_spike, post_spike, g, Apre, Apost, current, W = bm.for_loop(run, [indices, I_pre, I_post])
- Parameters:
tau_s (
Union
[float
,TypeVar
(ArrayType
,Array
,Variable
,TrainVar
,Array
,ndarray
),Callable
]) – float. The time constant of \(A_{pre}\).tau_t (
Union
[float
,TypeVar
(ArrayType
,Array
,Variable
,TrainVar
,Array
,ndarray
),Callable
]) – float. The time constant of \(A_{post}\).A1 (
Union
[float
,TypeVar
(ArrayType
,Array
,Variable
,TrainVar
,Array
,ndarray
),Callable
]) – float. The increment of \(A_{pre}\) produced by a spike. Must be a positive value.A2 (
Union
[float
,TypeVar
(ArrayType
,Array
,Variable
,TrainVar
,Array
,ndarray
),Callable
]) – float. The increment of \(A_{post}\) produced by a spike. Must be a positive value.pre (
JointType
[DynamicalSystem
,SupportAutoDelay
]) – DynamicalSystem. The pre-synaptic neuron group.delay (
Union
[None
,int
,float
]) – int, float. The pre spike delay length. (ms)syn (
ParamDescriber
) – DynamicalSystem. The synapse model.comm (
JointType
[DynamicalSystem
,SupportSTDP
]) – DynamicalSystem. The communication model, for example, dense or sparse connection layers.out (
ParamDescriber
) – DynamicalSystem. The synaptic current output models.post (
DynamicalSystem
) – DynamicalSystem. The post-synaptic neuron group.