NClab 8
NClab 8
1 Aims
• Model the process of Hebbian learning
• Explore alternative learning rules with additional constraints that are more biologically plausible
2 Theoretical Background
In his influential work in 1949, The Organization of Behavior, Donald Hebb postulated that "When an axon of cell
A is near enough to excite a cell B and repeatedly or persistently takes part in firing it, some growth process or
metabolic change takes place in one or both cells such that A’s efficiency, as one of the cells firing B, is increased".
Later, this became known with the catchy phrase "cells that fire together wire together". Later studies expanded and
generalized this concept, to now state that in general the strength of the connection between two neurons depends
on the correlation present in their activities. This principle is consistent with the experimental observations of
long-term potentiation (LTP) and long-term depression (LTD)1 . Note that other forms of non-Hebbian plasticity
exist as well, that are not dependent on the correlations between the pre- and post-synaptic cell activities. An
example of such a process is synaptic scaling2 , however we will not deal with such forms here.
What we will look at in this lab are phenomenological models (not based on detailed biophysical models of
neurons, just modeling inputs and outputs essentially), and specifically ones that are based on neuronal firing rate,
rather than spike-timing models.
where τr is the time constant of the firing rate dynamics. When the firing rate changes much quicker than inputs
arrive (τr → 0), reduces to:
Pn
υ = w.u = 1 wi ui
1 For a review, see Malenka and Bear, 2004, https://doi.org/10.1016/j.neuron.2004.09.012
2 see Abbott and Nelson, Nature Neuroscience, 2000, for a general review.
1
which basically means that the activity of our postsynaptic neuron is given just by scaling each input by the
strength of its connection with the neuron and then adding them all together. This is the case we will consider
here.
Plasticity means changes in the connections between neurons, meaning that we need an equation for the dynamics
of the weights. In the simplest form that Hebb’s postulate would imply, this equation would be:
τw dw
dt = υu
where τw is the time constant that shows how quickly the weights change. Sometimes you might also see
η = 1/τw , where η (the Greek letter "eta") is called the learning rate.
If firing rates and weights are constrained to be non-negative, then you can easily see that this rule quickly leads
to runaway excitation, since there is a positive feedback loop between weights and activity of the neuron. Even if
we constrain the weights to some upper wmax then all of the weights will saturate at some point, meaning that the
neuron will no longer exhibit any selectivity between its inputs.
Also, following this rule, there is only potentiation (analogous to LTP) of the synapses. To additionally model
depression (LTD), we can use a modified version of the above rule, called the covariance rule:
τw dw
dt = (υ − θυ )u where θυ is a threshold that controls what level of activity is needed to have potentiation of
connections instead of depression. Note that this rule is still a positive feedback loop and so inherently unstable.
This, by itself, is not very different from the covariance rule. Indeed, it would also be unstable, were it not
for the essential difference that the authors introduced, which is a sliding threshold. So the dynamics of the
threshold is given by:
τθ dθ 2
dt = υ − θυ , where, as always, τθ is the time constant.
υ
In essence, when the firing rate becomes too high, it increases the threshold for potentiation, which has the
effect of depressing a number of synapses. Thus, we have an implicit competition between synapses.
• Subtractive normalization. A more explicit way to introduce competition between P synapses is to set the
sum of all weights to a constant value. The sum of weights can be written as wi = o.w, where o is an
n-dimensional vector of ones (and then the dot product gives a scalar value which is the sum of the values in
υ(o.u)o
vector w). To accomplish the constraint, the learning rule is written as: τw dw
dt = υu − n
What this essentially means is that from the weight changes that would happen under the naive Hebb rule
we subtract a constant amount that depends on the sum of all weights.
• Oja’s rule.4 This is an instance of multiplicative normalization, because for each weight the difference
from the naive Hebb rule is proportional to the the weight itself. The dynamics is given by:
τw dw 2
dt = υu − αυ w, where α is a positive constant.
3 See EL Bienenstock, LN Cooper and PW Munro, 1982. DOI: https://doi.org/10.1523/JNEUROSCI.02-01-00032.1982
4 Oja, E. J. Math. Biology (1982) 15: 267. https://doi.org/10.1007/BF00275687
2
3 Model Setup
Here we will model just one linear neuron which receives√ two inputs for simplicity. Consider the case where there
are two possible input patterns: u = (1, 0) or u = (1/2, 23 ). You can initialize the weights at some value (a good
starting point is 0.5 for both). Let τw = 100 to start with (from this you can calculate η as well).
• Decide on a duration for your simulation and the timestep size. (I would suggest simulations with >1000
timesteps)
• Create an array that holds the input pattern the neuron receives at each timestep. The function randsample
might come in handy.
• Create an array that will hold the weights of each connection at each timestep.
• Create an array that will hold the activity of the postsynaptic neuron at each timestep.
The above you will need for the simulation of every different rule. You might need additional structures specific to
each rule. Remember that it’s best to work with arrays in MATLAB instead of loops over values.
• First, constrain the weights between a wmin and a wmax . Then simulate the naive Hebb rule. Remember
that you need to update the weights one timestep at a time, taking the previous timepoint’s value as input to
calculate the current one. Plot the evolution of the weights with time. Discuss your observations with your
neighbours.
• Try different initial weights (and different for each neuron as well). Discuss your expectations before you run
the simulation.
• Change the learning rate as well. Are your expectations matching the results?
• Now, simulate the covariance rule. Try this with different thresholds. (You can try starting with θυ = 1)
3
Figure 1: BCM rule results
• (Bonus but encouraged) If you want to try something more fancy, you can visualize phase portrait of the
system. Look at the function quiver in MATLAB.
• Try different initial weights for the inputs, as well as different initial thresholds.
• What effect does the learning rate have on the evolution of the system?
• Explore what the effect of τθ is. Try a number of different values. You can get some really interesting patterns.
You might even see something cool, like in Figure 2. (The parameters that produce Figure 2 are not the same
that produce Figure 1!!) Discuss what you see and try to explain the behaviour in each case.
4
6 Subtractive Normalization
Now, try to simulate the subtractive normalization rule. In our case the second term of the right-hand side of the
equation would just be: υ*sum(weights)*ones(1, n)/n. If this is in some way unclear, ask for further explanations.
Again try to explore the effect that different parameters have on the evolution of the system. Try to plot the phase
portrait.
7 Oja’s rule
Finally, simulate Oja’s rule. Explore the effect of α. How does this rule differ from the other ones you have
simulated?
8 (Extra)
• Try giving the neuron random inputs, instead of the fixed ones. Make these inputs positively or negatively
correlated.
• Simulate a neuron that receives more than 2 connections, for example from 8 neurons representing different
orientation angles. This would look at the emergence of orientation selectivity.