| 1 |
#!/usr/bin/env python |
| 2 |
""" |
| 3 |
Inhibitory synaptic plasticity in a recurrent network model |
| 4 |
----------------------------------------------------------- |
| 5 |
(F. Zenke, 2011) (from the 2012 Brian twister) |
| 6 |
|
| 7 |
Adapted from: |
| 8 |
|
| 9 |
Vogels, T. P., H. Sprekeler, F. Zenke, C. Clopath, and W. Gerstner. |
| 10 |
Inhibitory Plasticity Balances Excitation and Inhibition in Sensory Pathways and Memory Networks. |
| 11 |
Science (November 10, 2011). |
| 12 |
|
| 13 |
""" |
| 14 |
|
| 15 |
from brian2 import * |
| 16 |
|
| 17 |
# ########################################### |
| 18 |
# Defining network model parameters |
| 19 |
# ########################################### |
| 20 |
|
| 21 |
NE = 8000 # Number of excitatory cells |
| 22 |
NI = NE/4 # Number of inhibitory cells |
| 23 |
|
| 24 |
tau_ampa = 5.0*ms # Glutamatergic synaptic time constant |
| 25 |
tau_gaba = 10.0*ms # GABAergic synaptic time constant |
| 26 |
epsilon = 0.02 # Sparseness of synaptic connections |
| 27 |
|
| 28 |
tau_stdp = 20*ms # STDP time constant |
| 29 |
|
| 30 |
simtime = 10*second # Simulation time |
| 31 |
|
| 32 |
# ########################################### |
| 33 |
# Neuron model |
| 34 |
# ########################################### |
| 35 |
|
| 36 |
gl = 10.0*nsiemens # Leak conductance |
| 37 |
el = -60*mV # Resting potential |
| 38 |
er = -80*mV # Inhibitory reversal potential |
| 39 |
vt = -50.*mV # Spiking threshold |
| 40 |
memc = 200.0*pfarad # Membrane capacitance |
| 41 |
bgcurrent = 200*pA # External current |
| 42 |
|
| 43 |
eqs_neurons=''' |
| 44 |
dv/dt=(-gl*(v-el)-(g_ampa*v+g_gaba*(v-er))+bgcurrent)/memc : volt (unless refractory) |
| 45 |
dg_ampa/dt = -g_ampa/tau_ampa : siemens |
| 46 |
dg_gaba/dt = -g_gaba/tau_gaba : siemens |
| 47 |
''' |
| 48 |
|
| 49 |
# ########################################### |
| 50 |
# Initialize neuron group |
| 51 |
# ########################################### |
| 52 |
|
| 53 |
neurons = NeuronGroup(NE+NI, model=eqs_neurons, threshold='v > vt', |
| 54 |
reset='v=el', refractory=5*ms, method='euler') |
| 55 |
Pe = neurons[:NE] |
| 56 |
Pi = neurons[NE:] |
| 57 |
|
| 58 |
# ########################################### |
| 59 |
# Connecting the network |
| 60 |
# ########################################### |
| 61 |
|
| 62 |
con_e = Synapses(Pe, neurons, on_pre='g_ampa += 0.3*nS') |
| 63 |
con_e.connect(p=epsilon) |
| 64 |
con_ii = Synapses(Pi, Pi, on_pre='g_gaba += 3*nS') |
| 65 |
con_ii.connect(p=epsilon) |
| 66 |
|
| 67 |
# ########################################### |
| 68 |
# Inhibitory Plasticity |
| 69 |
# ########################################### |
| 70 |
|
| 71 |
eqs_stdp_inhib = ''' |
| 72 |
w : 1 |
| 73 |
dApre/dt=-Apre/tau_stdp : 1 (event-driven) |
| 74 |
dApost/dt=-Apost/tau_stdp : 1 (event-driven) |
| 75 |
''' |
| 76 |
alpha = 3*Hz*tau_stdp*2 # Target rate parameter |
| 77 |
gmax = 100 # Maximum inhibitory weight |
| 78 |
|
| 79 |
con_ie = Synapses(Pi, Pe, model=eqs_stdp_inhib, |
| 80 |
on_pre='''Apre += 1. |
| 81 |
w = clip(w+(Apost-alpha)*eta, 0, gmax) |
| 82 |
g_gaba += w*nS''', |
| 83 |
on_post='''Apost += 1. |
| 84 |
w = clip(w+Apre*eta, 0, gmax) |
| 85 |
''') |
| 86 |
con_ie.connect(p=epsilon) |
| 87 |
con_ie.w = 1e-10 |
| 88 |
|
| 89 |
# ########################################### |
| 90 |
# Setting up monitors |
| 91 |
# ########################################### |
| 92 |
|
| 93 |
sm = SpikeMonitor(Pe) |
| 94 |
|
| 95 |
# ########################################### |
| 96 |
# Run without plasticity |
| 97 |
# ########################################### |
| 98 |
eta = 0 # Learning rate |
| 99 |
run(1*second) |
| 100 |
|
| 101 |
# ########################################### |
| 102 |
# Run with plasticity |
| 103 |
# ########################################### |
| 104 |
eta = 1e-2 # Learning rate |
| 105 |
run(simtime-1*second, report='text') |
| 106 |
|
| 107 |
# ########################################### |
| 108 |
# Make plots |
| 109 |
# ########################################### |
| 110 |
|
| 111 |
i, t = sm.it |
| 112 |
subplot(211) |
| 113 |
plot(t/ms, i, 'k.', ms=0.25) |
| 114 |
title("Before") |
| 115 |
xlabel("") |
| 116 |
yticks([]) |
| 117 |
xlim(0.8*1e3, 1*1e3) |
| 118 |
subplot(212) |
| 119 |
plot(t/ms, i, 'k.', ms=0.25) |
| 120 |
xlabel("time (ms)") |
| 121 |
yticks([]) |
| 122 |
title("After") |
| 123 |
xlim((simtime-0.2*second)/ms, simtime/ms) |
| 124 |
show() |