Incorporating STDP in a network

Moderator: wwlytton

Post Reply
pascal
Posts: 116
Joined: Thu Apr 26, 2012 11:51 am

Incorporating STDP in a network

Post by pascal »

I am attempting to incorporate STDP in a network model, and I am starting with a two-neuron network in which I want to incorporate a very simple STDP model. Reading around, I see various references to a mod file for STDP written ages ago by Michael Hines (e.g., viewtopic.php?p=20082&hilit=stdp#p20082 and viewtopic.php?f=16&t=470&p=1614#p1614), but the links don't work and I can't definitively find this mythical mod file anywhere. I think this *might* be it: https://modeldb.science/152197?tab=2&fi ... o/stdp.mod

Code: Select all

NEURON {
	POINT_PROCESS ExpSynSTDP
	RANGE tau, e, i, d, p, dtau, ptau, verbose, learning, LR, maxWeight, minWeight
	NONSPECIFIC_CURRENT i
}

UNITS {
	(nA) = (nanoamp)
	(mV) = (millivolt)
	(uS) = (microsiemens)
}

PARAMETER {
	tau = 0.1 (ms) <1e-9,1e9>
	e = 0	(mV)
	d = 0 <0,1>: depression factor (multiplicative to prevent < 0)
	p = 0 : potentiation factor (additive, non-saturating)
	dtau = 34 (ms) : 34 depression effectiveness time constant
	ptau = 17 (ms) : 17 Bi & Poo (1998, 2001)
	verbose = 0
	learning = 1
	LR = 0.0001
	maxWeight = 1
	minWeight = 0
}

ASSIGNED {
	v (mV)
	i (nA)
	tpost (ms)
}

STATE {
	g (uS)
}

INITIAL {
	g=0
	tpost = -1e9
	net_send(0, 1)
}

BREAKPOINT {
	SOLVE state METHOD cnexp
	i = g*(v - e)
}

DERIVATIVE state {
	g' = -g/tau
}

NET_RECEIVE(w (uS), tpre (ms)) {
	INITIAL { tpre = -1e9 }
	if (flag == 0) { : presynaptic spike  (after last post so depress)
		g = g + w
		if(learning) {
			if (w>=minWeight){
				w = w-LR*d*exp((tpost - t)/dtau)
				if(w<=minWeight){
					w=minWeight
				}
				:w = w*LR*d*(1-(exp((tpost - t)/dtau)))
				if(verbose) {
					printf("dep: w=%g \t dw=%g \t dt=%g\n", w, -LR*d*exp((tpost - t)/dtau), tpost-t)
				}
			}
		}
		tpre = t
	}else if (flag == 2) { : postsynaptic spike
		tpost = t
		FOR_NETCONS(w1, tp) { : also can hide NET_RECEIVE args
        	if(learning) {
        		if (w1<=maxWeight){
	        		w1 = w1+LR*p*exp((tp - t)/ptau)
	        		if (w1>maxWeight){
	        			w1 = maxWeight
	        		}
	        		if(verbose) {
	        			printf("pot: w=%g \t dw=%g \t dt=%g\n", w1, (LR*p*exp((tp - t)/ptau)), t - tp)
	        		}
	        	}
        	}
		}
	} else { : flag == 1 from INITIAL block
		WATCH (v > -20) 2
	}
}
In any case, I do have a few questions about how this mod file works. I assume the WATCH statement in line 85 sets the flag to be equal to 2 whenever the post-synaptic cell's membrane potential breaches -20 mV.

My first question: is there anywhere I can find documentation for the WATCH command? Neither https://www.neuron.yale.edu/neuron/stat ... ight=nmodl nor https://www.neuron.yale.edu/neuron/stat ... modl2.html appear to say anything about it.

Second, how do we know flag==0 implies a pre-synaptic spike? (line 54) Is setting flag=0 the default behavior of NEURON/NMODL when a pre-synaptic spike occurs? I could not find this anywhere in the documentation, either. Thank you.
pascal
Posts: 116
Joined: Thu Apr 26, 2012 11:51 am

Re: Incorporating STDP in a network

Post by pascal »

I found the answer to my second question. In section 10.1.7.5 of The NEURON Book (describing the NET_RECEIVE block of a mod file), it states, "every event has an implicit argument called flag, the value of which is automatically 0 for an external event."

It would still be very nice if someone could point me in the direction of documentation on the WATCH command. I am particularly interested in making sure I use it correctly within parallel simulations.
Post Reply