Hebbian learning in the weight plane

Plain Hebbian learning, saturation bounds and Oja’s rule, animated as trajectories in the space of two synaptic weights.

Three learning rules for a neuron with two inputs, watched in the plane of its two weights. Everything on this page runs in your browser; nothing to install. Change a slider while a simulation is running and it reacts immediately.

One neuron receives two inputs with activities \(u_1, u_2\) through weights \(w = (w_1, w_2)\). Averaged over many input patterns, learning is driven by the input correlation matrix \(Q = \langle u u^{\mathsf T} \rangle\), here \(Q = \begin{pmatrix} 1 & q \\ q & 1 \end{pmatrix}\), where \(q\) is the correlation between the two inputs (the slider). \(\tau\) sets the learning speed and \(\alpha\) is the strength of the normalising term in Oja’s rule. Three rules:

\[\text{Hebbian:}\quad \tau \frac{dw}{dt} = Q\,w\]

\[\text{with bounds:}\quad \tau \frac{dw}{dt} = Q\,w, \qquad 0 \le w_i \le 1\]

\[\text{Oja:}\quad \tau \frac{dw}{dt} = Q\,w - \alpha\,(w^{\mathsf T} Q\, w)\,w\]

Pick a rule, then click anywhere in the weight plane to choose an initial condition.

What you see. Left: the weight plane, \(w_1\) against \(w_2\). The faint lines are trajectories from a grid of starting points, coloured by where they end after 100 steps. With bounds: blue ends at \((1,1)\), orange at \((0,1)\), green at \((1,0)\). With Oja’s rule: blue ends at \((1,1)/\sqrt2\), orange at \((-1,1)/\sqrt2\), green at \((1,-1)/\sqrt2\). Grey means none of these, which for plain Hebbian learning is every trajectory, since they all run off to infinity. The thick line is your trajectory, starting at the open circle and ending at the filled dot, which takes the colour of its end state once it has arrived. Right: the same trajectory as \(w_1\) (purple) and \(w_2\) (teal) against time.

Try: plain Hebbian learning runs away along the leading eigenvector of \(Q\), whichever way you start. With bounds the plane splits into basins of attraction. Oja’s rule keeps \(|w|\) finite and converges to a normalised eigenvector of \(Q\). Change \(q\) to see the basins move. From the Hebbian learning exercise in Theoretical Neuroscience.