Plasticity¶
Note
The classes below are only working with the Connection
class.
Consider using the newer Synapses
class as a replacement, it
allows you to flexibily express plasticity rules in a very similar way to
the classes below. A single Synapses
object can therefore
completely replace the combination of Connection
+
STDP
, for example. See Synapses for more details.
Spike timing dependent plasticity (STDP)¶

class
brian.
STDP
(C, eqs, pre, post, wmin=0, wmax=inf, level=0, clock=None, delay_pre=None, delay_post=None)¶ Spiketimingdependent plasticity
Initialised with arguments:
C
 Connection object to apply STDP to.
eqs
 Differential equations (with units)
pre
 Python code for presynaptic spikes, use the reserved symbol
w
to refer to the synaptic weight. post
 Python code for postsynaptic spikes, use the reserved symbol
w
to refer to the synaptic weight. wmin
 Minimum weight (default 0), weights are restricted to be within this value and wmax.
wmax
 Maximum weight (default unlimited), weights are restricted to be within wmin and this value.
delay_pre
 Presynaptic delay
delay_post
 Postsynaptic delay (backward propagating spike)
The STDP object works by specifying a set of differential equations associated to each synapse (
eqs
) and two rules to specify what should happen when a presynaptic neuron fires (pre
) and when a postsynaptic neuron fires (post
). The equations should be standard set of equations in the usual string format. Thepre
andpost
rules should be a sequence of statements to be executed triggered on pre and postsynaptic spikes. The sequence of statements can be separated by a;
or by using a multiline string. The reserved symbolw
can be used to refer to the synaptic weight of the associated synapse.This framework allows you to implement most STDP rules. Specifying differential equations and pre and postsynaptic event code allows for a much more efficient implementation than specifying, for example, the spike pair weight modification function, but does unfortunately require transforming the definition into this form.
There is one restriction on the equations that can be implemented in this system, they need to be separable into independent pre and postsynaptic systems (this is done automatically). In this way, synaptic variables and updates can be stored per neuron rather than per synapse.
Example
eqs_stdp = """ dA_pre/dt = A_pre/tau_pre : 1 dA_post/dt = A_post/tau_post : 1 """ stdp = STDP(C, eqs=eqs_stdp, pre='A_pre+=delta_A_pre; w+=A_post', post='A_post+=delta_A_post; w+=A_pre', wmax=gmax)
STDP variables
You can access the pre and postsynaptic variables as follows:
stdp = STDP(...) print stdp.A_pre
Alternatively, you can access the group of pre/postsynaptic variables as:
stdp.pre_group stdp.post_group
These latter attributes can be passed to a
StateMonitor
to record their activity, for example. However, note that in the case of STDP acting on a connection with heterogeneous delays, the recent values of these variables are automatically monitored and these can be accesses as follows:stdp.G_pre_monitors['A_pre'] stdp.G_post_monitors['A_post']
Technical details
The equations are split into two groups, pre and post. Two groups are created to carry these variables and to update them (these are implemented as
NeuronGroup
objects). As well as propagating spikes from the source and target ofC
viaC
, spikes are also propagated to the respective groups created. At spike propagation time the weight values are updated.

class
brian.
ExponentialSTDP
(C, taup, taum, Ap, Am, interactions='all', wmin=0, wmax=None, update='additive', delay_pre=None, delay_post=None, clock=None)¶ Exponential STDP.
Initialised with the following arguments:
taup
,taum
,Ap
,Am
Synaptic weight change (relative to the maximum weight wmax):
f(s) = Ap*exp(s/taup) if s >0 f(s) = Am*exp(s/taum) if s <0
interactions
 ‘all’: contributions from all prepost pairs are added
 ‘nearest’: only nearestneighbour pairs are considered
 ‘nearest_pre’: nearest presynaptic spike, all postsynaptic spikes
 ‘nearest_post’: nearest postsynaptic spike, all presynaptic spikes
wmin=0
 minimum synaptic weight
wmax
 maximum synaptic weight
update
 ‘additive’: modifications are additive (independent of synaptic weight) (or “hard bounds”)
 ‘multiplicative’: modifications are multiplicative (proportional to w) (or “soft bounds”)
 ‘mixed’: depression is multiplicative, potentiation is additive
See documentation for
STDP
for more details.
Short term plasticity (STP)¶

class
brian.
STP
(C, taud, tauf, U)¶ Shortterm synaptic plasticity, following the TsodyksMarkram model.
Implements the shortterm plasticity model described in Markram et al (1998). Differential signaling via the same axon of neocortical pyramidal neurons, PNAS. Synaptic dynamics is described by two variables x and u, which follow the following differential equations:
dx/dt=(1x)/taud (depression) du/dt=(Uu)/tauf (facilitation)
where taud, tauf are time constants and U is a parameter in 0..1. Each presynaptic spike triggers modifications of the variables:
u<u+U*(1u) x<x*(1u)
Synaptic weights are modulated by the product
u*x
(in 0..1) (before update).Reference:
 Markram et al (1998). “Differential signaling via the same axon of neocortical pyramidal neurons”, PNAS.