Example of STDP ( Please Help )

54 views
Skip to first unread message

Henry Miller

unread,
Jul 19, 2020, 6:57:42 AM7/19/20
to Brian
Hi all,

I am trying to replicate the example in https://brian2.readthedocs.io/en/stable/examples/synapses.STDP.html. This time round, I am using my own units.
For instance I have A+ = 107.84 % and A- = -45.36 % (It is in percentage). My STDP fitted values are % change plotted against delta t. I made the following changes with no. of Poisson neurons
as 100 instead of 1000. However after running the below code, all my final conductances reached the maximum value. Something is wrong over here? Has it got to do with the magnitude or whatever? Please 
help and thanks!!






---------------------------------------------------------------------------- CODE ------------------------------------------------------------------------------------------------------


from brian2 import *
start_scope()

N = 100  # Original N is 1000
taum = 64*ms
taupre = 127*ms
taupost = taupre
Ee = 0*mV
vt = -0.5*mV
vr = -0.5*mV
El = -0*mV
taue = 32*ms
F = 15*Hz   # Original F is 15
gmax = 140e-6 # Maximum conductance
dApre = 1.0784
dApost = -0.4536
dApost *= gmax
dApre *= gmax

eqs_neurons = '''
dv/dt = (ge * (Ee-vr) + El - v) / taum : volt
dge/dt = -ge / taue : 1
'''

input = PoissonGroup(N, rates=F)
neurons = NeuronGroup(1, eqs_neurons, threshold='v>vt', reset='v = vr',
                      method='exact')
S = Synapses(input, neurons,
             '''w : 1
                dApre/dt = -Apre / taupre : 1 (event-driven)
                dApost/dt = -Apost / taupost : 1 (event-driven)''',
             on_pre='''ge += w
                    Apre += dApre
                    w = clip(w + Apost, 0, gmax)''',
             on_post='''Apost += dApost
                     w = clip(w + Apre, 0, gmax)''',
             )
S.connect()
S.w = 'rand() * gmax'
#print(S.w)
mon = StateMonitor(S, 'w', record=[0, 1])
###############################
M = StateMonitor(neurons,'v',record=True) # Monitor the potential of the neuron
###############################
s_mon = SpikeMonitor(input)

run(100*second, report='text') # Original 100 second

subplot(311)
plot(S.w / gmax, '.k')
ylabel('Weight / gmax')
xlabel('Synapse index')
subplot(312)
hist(S.w / gmax, 20)
xlabel('Weight / gmax')
subplot(313)
plot(mon.t/second, mon.w.T/gmax)
xlabel('Time (s)')
ylabel('Weight / gmax')
tight_layout()
show()

#print(S.w)



--------------------------------------------------------- OUTPUT ---------------------------------------------------------------


Marcel Stimberg

unread,
Aug 4, 2020, 5:41:54 AM8/4/20
to Brian
Hi Henry,
note that this mailing list is meant to be about technical questions concerning the Brian simulator, not for general questions about modelling (even though of course the line to draw between them is not always clear). This issue here rather falls in the general category I think... If you set A+ to a value that is even bigger than g_max, then it is not surprising that your weights saturate: from the equations you see that a single post-synaptic spike is enough to make the weight go the maximum value. Your equations for the post-synaptic neuron seem a bit odd as well, doesn't it spike continuously even in the absence of inputs (the resting value is bigger than the threshold)?
Best,
  Marcel

Reply all
Reply to author
Forward
0 new messages