Global nmodl reward variable?

Moderator: wwlytton

Post Reply
Joe29
Posts: 4
Joined: Wed Sep 30, 2009 10:02 pm

Global nmodl reward variable?

Post by Joe29 » Mon Oct 12, 2009 2:55 pm

Hi All,

Quick question. Are the GLOBAL variables in a mod file accessible to other mod files? If so, how is this constructed? If not, what is the best way to make a variable ... globally... accessible?
I was still unsure after looking through the neuron book. From looking at other peoples code I am led to believe that the variables are truly global, as is the case with certain ion/ligand concentrations.
I am constructing a network with a learning algorithm, and wish for all the neurons to have access to my reward variable.

Thanks,
Joe

ted
Site Admin
Posts: 5570
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Global nmodl reward variable?

Post by ted » Mon Oct 12, 2009 3:50 pm

A variable that is declared GLOBAL in the NEURON block of a mechanism will have the same value in every instance of that mechanism.

Joe29
Posts: 4
Joined: Wed Sep 30, 2009 10:02 pm

Re: Global nmodl reward variable?

Post by Joe29 » Mon Oct 12, 2009 9:29 pm

Ok, I see. Thanks. And is there any way to communicate between different mechanisms?

ted
Site Admin
Posts: 5570
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Global nmodl reward variable?

Post by ted » Mon Oct 12, 2009 9:45 pm

At least three, but which is best for any particular application depends on situation-specific details. In very sketchy outline, and with no guidance whatsoever, here they are:
1. pointer variables
2. events
3. exploiting "intracellular or extracellular ionic concentrations" to pass values between mechanisms in the same segment
To give more specific advice I would need a clearer idea of what you have in mind. If you prefer, this could be discussed via private email.

Joe29
Posts: 4
Joined: Wed Sep 30, 2009 10:02 pm

Re: Global nmodl reward variable?

Post by Joe29 » Tue Oct 13, 2009 3:55 pm

Ok.
The part of the model needing some kind of global variable is fairly simple to explain.
Basically, I have a network of cells, in very straight-forward 'layers' (input/hidden/output). I am exploring a stochastic learning algorithm. There is only one output cell, and it is much more simplified than the others (the others being H+H), with an nmodl mechanism on the last cell which determines the 'reward'. The weights of the network are changed according to this reward. So, I would like all of the other cells to have access to this variable. This rules out option #3. It seems possible to use pointers, although I did give it a shot and was getting all sorts of errors I couldn't identify (probably just my inexperience with Neuron). How would one use events in this type of situation?

Thanks for your help,
Joe

ted
Site Admin
Posts: 5570
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Global nmodl reward variable?

Post by ted » Tue Oct 13, 2009 4:21 pm

Joe29 wrote:The weights of the network are changed according to this reward.
And you want this to occur continuously in time, rather than through an iterative process

Code: Select all

REPEAT
  run a simulation
  compute the reward during or after the simulation
  adjust the weights after the simulation
UNTIL some criterion is met
I would like all of the other cells to have access to this variable. This rules out option #3.
Yes, option 3 would be most suitable for learning rules that are "spatially localized."
It seems possible to use pointers, although I did give it a shot and was getting all sorts of errors I couldn't identify (probably just my inexperience with Neuron). How would one use events in this type of situation?
Events might be suitable for a rule in which the reward changes only when some variable in the output cell crosses a threshold. The reward value would thus look like a "staircase" that wanders up or down at irregular intervals. If that is what you want, let me know and I'll go into greater detail.

If you want the reward to vary continuously in time, your plastic synaptic mechanism needs to declare a pointer variable in the NEURON block. That variable would be used somewhere in the NET_RECEIVE block to scale the effective weights of events received by the synaptic mechanism.

Model setup must at some point use a setpointer() statement in hoc to establish a link between the mechanism's POINTER variable, and whatever variable holds the numerical value of the reward (in your case, a value that is calculated by a mechanism attached to the output cell). Since you stipulate that the reward is a global variable, only one setpointer() statement will be necessary.

If you are having difficulty getting this to work, send me a toy network (something with just a few cells and synapses in it) and I will be glad to take a look at it and help you get it going. Please see
What to include in a zip file, and what to leave out
viewtopic.php?f=28&t=560
My email address is ted dot carnevale at yale dot edu

Post Reply