Hello all! I just came across the code on

Example: STDP — Brian 2 2.0rc documentation and my aim here is to train the synaptic weights using these parameters to learn the features of my encoded data. Here is how my input feature looks like (1):

## What I Did: Encode the input data into a long array, such that when visualised, it appears as above. Then using the long array as a TImed array with Poisson spikes proportional to intensity, I ran the simulation for quite some time and I visualised the final synaptic weights. I was expecting the weights to appear similar to (1) but what appears is (2): where it seems like the weights have blown up to the maximum value (Yellow) for most of the proportion, which shouldnt be the case??? I am not sure what could be wrong here. I have attached the code:

start_scope()

N = 80

taum = 10*ms
taupre = 20*ms

taupost = taupre

Ee = 0

*mV*

vt = -54mV

vt = -54

vr = -60

*mV*

El = -74mV

El = -74

taue = 5*ms

gmax = 0.02 # 0.02

dApre = .01

dApost = -dApre * taupre / taupost * 0.05

dApost *= gmax

dApre *= gmax

eqs_neurons = ‘’’

dv/dt = (ge * (Ee-v) + El - v) / taum : volt

dge/dt = -ge / taue : 1

‘’’

P = PoissonGroup(N, rates=‘stimulus(t,i)’)

G = NeuronGroup(1, eqs_neurons, threshold=‘v>vt’, reset=‘v = vr’,

method=‘euler’)

S = Synapses(P, G,

‘’‘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_initial = 0.02

S_initial = np.random.uniform(low=0,high=1,size=(1,80)) * gmax

#S_initial = np.random.normal(0.015,0.001,N)

#S_initial = ‘rand() * gmax’

#S_initial = np.random.uniform(low=0,high=100,size=(1,80))

S.w = S_initial

M = StateMonitor(G, ‘v’, record=True) #monitors the membrane voltage

evo = StateMonitor(S,‘w’,record=True)

spikemon_in = SpikeMonitor§ #records spikes from input neurons

spikemon_out = SpikeMonitor(G) #records spikes from output neurons

run(len(long2)*duration*ms,report=‘text’) # Dont need last refractory period

#run(6*duration*ms,report=‘text’)

Over here, I used 80 neurons for the input array and ‘stimulus(t,i)’ refers to my timed array corresponding to intensities of the input data as shown in first image. Someone could maybe advise on this? Thanks!