nengo/nengo-1.4

How do you define a custom tuning curve for a lif neuron

neuronicprogrammer opened this issue · 3 comments

I need to set a custom tuning curve for a number of neurons. How is this done in python? If not python which java method is used to set and display tuning curves.

It depends on how much you want to customize the tuning curves. If you want a completely different shape, then you need a different neuron model (e.g., a linear or sigmoid neuron -- though those typically aren't biologically plausible).

If you want to change the properties of the LIF tuning curve--e.g., setting the bias, gain, x-intercept, etc.--then you can add keyword arguments to a net.make call. See http://nengo.ca/docs/html/nef.Network.html#nef.Network.make The arguments of interest are max_rate, and intercept. You can also specify the encoders through this interface.

You can see the tuning curves of a population by right-clicking on one and selecting Plot > Constant Rate Responses.

Thanks - what is the actual shape for the default LIF? Is it a gaussian? I keep seeing references to PDF in the source code. Is this where the default shape comes from?

Here's the actual shape: http://nengo.ca/docs/html/tutorial1.html#plotting-tuning-curves (that's 100 different randomly generated tuning curves)

It comes from this equation: http://en.wikipedia.org/wiki/Biological_neuron_model#Leaky_integrate-and-fire

Basically, if you put a small amount of current into the cell, it doesn't fire. As you increase that amount of current, it starts firing, then fires faster and faster. However, the cell's refractory period limits how quickly it can fire, so this firing rate levels off at some maximum value.

More technically, what I just described there is often just called the neuron's response function, as it's a mapping from current to firing rate. When people talk about tuning curves, they often mean something more complicated, such as a mapping between some real-world value and a firing rate. This is where things start to get a little more complicated, but one side effect is that we can actually use these default LIF neurons to produce gaussian-like tuning curves (actually, instead of Gaussians they're cosine tuning curves, but close enough).

So, here's one way to get a gaussian-like tuning curve: make a 2D ensemble. This is a group of neurons representing a two-dimensional vector (such as a position in x,y space). Now, each neuron will have a random preferred direction vector in that space, and the amount of current flowing into each neuron will be proportional to the dot product of the preferred direction and the value being represented. Now, if we wanted to plot its full tuning curve, that'd be a 3d graph (a different firing rate for each point in x,y space). But, most neuroscientists don't plot that full curve, instead they pick some subset of that space, such as all the points on a unit circle. I you plot that, you get exactly the classic cosine-shaped tuning curves. For instance, see figure 2 in http://www.sciencedirect.com/science/article/pii/S0165017307000720

You can get this graph in Nengo by opening demo/2drepresentation.py and going to the interactive plots, right-clicking on "neurons" and choosing the "tuning curves" plot.

So, all of that said, if you've got a complex representation, then you can think of the LIF tuning curves as gaussians (or cosines), since they have some preferred stimulus for which they fire most strongly, and as the stimulus differs from that preferred stimulus, they fire less strongly. But, at the same time, what's happening at the level of an individual neuron is that, just like real neurons, they fire more the more input they get. If you plot the LIF curve in terms of the mapping between current and firing rate, you get one of these http://nengo.ca/docs/html/tutorial1.html#plotting-tuning-curves but if you plot it in terms of the similarity of the input to the preferred direction, then you get nice gaussian/cosines.

Does that help?