Hopfield Networks
Robert M. Keller
February 2016
Hopfield Networks
Proposed in 1982 by John Hopfield: formerly Professor at Princeton, Caltech, now again at Princeton
Hopfield may have been the first to observe the connection of these networks to Ising models (or spin models) known in physics.
John Hopfield
Use of Hopfield Nets
Hopfield nets extend the idea of linear associator, �by adding recurrent connections.
They may be used as associative memories.
Hopfield nets offer more robust error-correction and de-noising than their non-recurrent counterparts.
Extensions of Hopfield Nets
Hopfield nets are a gateway model for others, such as:
Successive (L to R) Images (130x180 pixels) from Hopfield’s Paper
Enhancement
Association
Completion
Application
Hopfield Net Diagram
There is a delay in the output fed back as input.
There are no input lines as such.
The inputs are the initial values in the neurons.
The outputs are “read out” from the neurons.
The diagonal weights are 0: wii = 0.
The weights are symmetric: wij = wji.
Thresholds/Biases
Learning
Several Variations on One Model
General Update Method
General Update Method
Example Synchronous Operation
Assume activation is a threshold function with threshold 0.
Assume weight matrix is W:
0 | -1 | -1 | 1 | -1 |
-1 | 0 | 1 | -1 | 1 |
-1 | 1 | 0 | -1 | 1 |
1 | -1 | -1 | 0 | -1 |
-1 | 1 | 1 | -1 | 0 |
Example Synchronous Operation
Assume activation is a threshold function with threshold 0.
If the current state is 1 1 1 1 1, then the weighted sums are on the right:
The implied next state is thus 0 1 1 0 1.
0 | -1 | -1 | 1 | -1 |
-1 | 0 | 1 | -1 | 1 |
-1 | 1 | 0 | -1 | 1 |
1 | -1 | -1 | 0 | -1 |
-1 | 1 | 1 | -1 | 0 |
-2 |
0 |
0 |
-2 |
0 |
Example Synchronous Operation
Assume activation is a threshold function with threshold 0.
If the current state is 0 1 1 0 1, then the weighted sums are on the right:
The implied next state is thus 0 1 1 0 1. Now no neuron is firable, so the network will persist in state 0 1 1 0 1.
0 | -1 | -1 | 1 | -1 |
-1 | 0 | 1 | -1 | 1 |
-1 | 1 | 0 | -1 | 1 |
1 | -1 | -1 | 0 | -1 |
-1 | 1 | 1 | -1 | 0 |
-3 |
2 |
2 |
-2 |
2 |
Example Asynchronous Operation
Assume activation is a threshold function with threshold 0.
If the current state is 1 1 1 1 1, then the weighted sums are on the right:
Suppose the first node fires, giving state 0 1 1 1 1.
0 | -1 | -1 | 1 | -1 |
-1 | 0 | 1 | -1 | 1 |
-1 | 1 | 0 | -1 | 1 |
1 | -1 | -1 | 0 | -1 |
-1 | 1 | 1 | -1 | 0 |
-2 |
0 |
0 |
-2 |
0 |
Example Asynchronous Operation
Assume activation is a threshold function with threshold 0.
If the current state is 1 1 1 1 1, then the weighted sums are on the right:
Alternatively, the fourth node could fire first, giving state 1 1 1 0 1.
0 | -1 | -1 | 1 | -1 |
-1 | 0 | 1 | -1 | 1 |
-1 | 1 | 0 | -1 | 1 |
1 | -1 | -1 | 0 | -1 |
-1 | 1 | 1 | -1 | 0 |
-2 |
0 |
0 |
-2 |
0 |
Example Asynchronous Operation
Assume activation is a threshold function with threshold 0.
If the current state is 0 1 1 1 1, then the weighted sums are on the right:
If the first node fires, then the fourth node fires, we get state 0 1 1 0 1.
0 | -1 | -1 | 1 | -1 |
-1 | 0 | 1 | -1 | 1 |
-1 | 1 | 0 | -1 | 1 |
1 | -1 | -1 | 0 | -1 |
-1 | 1 | 1 | -1 | 0 |
-2 |
1 |
1 |
-3 |
1 |
Example Asynchronous Operation
Assume activation is a threshold function with threshold 0.
If the current state is 1 1 1 0 1, then the weighted sums are on the right:
If the fourth node fires first, then the first node, we get 0 1 1 0 1.
0 | -1 | -1 | 1 | -1 |
-1 | 0 | 1 | -1 | 1 |
-1 | 1 | 0 | -1 | 1 |
1 | -1 | -1 | 0 | -1 |
-1 | 1 | 1 | -1 | 0 |
-3 |
1 |
1 |
-2 |
1 |
Example Asynchronous Operation
Assume activation is a threshold function with threshold 0.
If the current state is 0 1 1 0 1, then the weighted sums are on the right:
Now no neuron is firable, so the network persists in state 0 1 1 0 1.
0 | -1 | -1 | 1 | -1 |
-1 | 0 | 1 | -1 | 1 |
-1 | 1 | 0 | -1 | 1 |
1 | -1 | -1 | 0 | -1 |
-1 | 1 | 1 | -1 | 0 |
-3 |
2 |
2 |
-3 |
2 |
Partial Summary of Behavior, Asynchronous Case
1 1 1 1 1
0 1 1 1 1
1 1 1 0 1
0 1 1 0 1
Red nodes are firable.
Summary of Synchronous vs. Asynchronous So Far
We see from the above example that, although the number of steps is different for asynchronous vs synchronous, the network ends in the same state in both cases.
Will this always be the case?
Diagram of All States
Asynchronous Operation
[1, 1, 0, 0, 0]
[0, 1, 0, 0, 0]
[1, 0, 0, 0, 0]
[1, 0, 1, 0, 0]
[0, 0, 1, 0, 0]
[1, 0, 0, 0, 1]
[0, 0, 0, 0, 1]
[0, 1, 0, 1, 0]
[0, 0, 0, 1, 0]
[0, 0, 1, 1, 0]
[0, 0, 0, 1, 1]
[1, 1, 1, 1, 0]
[0, 1, 1, 1, 0]
[1, 1, 1, 0, 0]
[1, 1, 0, 1, 0]
[1, 0, 1, 1, 0]
[1, 1, 0, 1, 1]
[0, 1, 0, 1, 1]
[1, 0, 1, 0, 1]
[1, 0, 0, 1, 1]
[1, 0, 1, 1, 1]
[0, 0, 1, 1, 1]
[0, 1, 1, 0, 0]
[1, 0, 0, 1, 0]
[0, 0, 1, 0, 1]
[0, 1, 0, 0, 1]
[1, 1, 1, 1, 1]
[1, 1, 1, 0, 1]
[0, 1, 1, 1, 1]
[0, 1, 1, 0, 1]
[0, 0, 0, 0, 0]
[0, 1, 1, 0, 0]
[1, 1, 0, 0, 1]
Energy and Computing the Weight Matrix
For the next part of this discussion, I will use {-1, 1} as neuron values, rather than {0, 1}.
However, I will show these as
to make the spacing look nice, i.e. no minus sign.
Energy and Computing the Weight Matrix
Another assumption we will make, standard with Hopfield networks:
A neuron is firable iff:
Thus if its activation is 0, it is not firable, regardless of its current state.
This questionable assumption is made to make the energy argument work out.
The “Energy” Function for a Hopfield Network
Example Energy Function
Assume activation is a threshold function with threshold 0.
If the current state is OOOOO, then the energy is 4.
0 | -1 | -1 | 1 | -1 |
-1 | 0 | 1 | -1 | 1 |
-1 | 1 | 0 | -1 | 1 |
1 | -1 | -1 | 0 | -1 |
-1 | 1 | 1 | -1 | 0 |
1 |
1 |
1 |
1 |
1 |
-1 | -1 | -1 | -1 | -1 |
Example Energy Function
Assume activation is a threshold function with threshold 0.
If the current state is IIIII, then the energy is -4.
0 | -1 | -1 | 1 | -1 |
-1 | 0 | 1 | -1 | 1 |
-1 | 1 | 0 | -1 | 1 |
1 | -1 | -1 | 0 | -1 |
-1 | 1 | 1 | -1 | 0 |
1 |
1 |
1 |
1 |
1 |
1 | 1 | 1 | 1 | 1 |
Example Energy Function
Assume activation is a threshold function with threshold 0.
If the current state is OIIOI, then the energy is -20.
0 | -1 | -1 | 1 | -1 |
-1 | 0 | 1 | -1 | 1 |
-1 | 1 | 0 | -1 | 1 |
1 | -1 | -1 | 0 | -1 |
-1 | 1 | 1 | -1 | 0 |
-1 |
1 |
1 |
-1 |
1 |
-1 | 1 | 1 | -1 | 1 |
Depicting Multiple Stable States
Energy Changes for Asynchronous Operation
Energy Changes for Asynchronous Operation
Note: Here is where we make use of the assumption that if a neuron’s activation is 0, it is not firable, regardless of its current state. Without this assumption, the energy could stay the same several states in a row, even though there is no cycle in the state diagram.
�
Listing of All States, Their Energies, and Successors
0 | -1 | -1 | 1 | -1 |
-1 | 0 | 1 | -1 | 1 |
-1 | 1 | 0 | -1 | 1 |
1 | -1 | -1 | 0 | -1 |
-1 | 1 | 1 | -1 | 0 |
Weight Matrix
Alphabetic Order
Sorted by Decreasing Energy
Partial State Diagram
0 | -1 | -1 | 1 | -1 |
-1 | 0 | 1 | -1 | 1 |
-1 | 1 | 0 | -1 | 1 |
1 | -1 | -1 | 0 | -1 |
-1 | 1 | 1 | -1 | 0 |
Weight Matrix
IOOIO (-20)
OIIOI (-20)
IIIOI (-4)
IIOIO (-4)
OOIOI (-4)
OOOIO (-4)
. . .
. . .
IIII0 (4)
IOIOI (4)
. . .
10 states with energy -4
2 states with energy -20
20 states with energy 4
For this particular network, each state has a unique limit state.�
This won’t always be the case.
Duality of Firing Rule and Energy Change
There are two ways of thinking about a hopfield network firing asynchronously:
In other words, think of the network as a minimum-energy-seeking device.
Minimizing Energy Example using the {O, I} model
Which value (O or I) gives the lower energy for the neuron marked ‘?’?
Case O (-1):
-4*I*O + 3*O*O + 3*O*O = �4 + 3 + 3 = 10
Case I (1):
-4*I*I + 3*O*I + 3*O*I = �-4 -3 -3 = -10
I
I
O
O
?
-4
-1
-1
3
2
3
3
Minimizing Energy Example using the {O, I} model
Which value (O or I) gives the lower energy for the neuron marked ‘?’?
Case O (-1):
Case I (1):
I
I
O
O
O
-4
-1
-1
3
2
3
3
Synchronous Updating Example
Both upper neurons want to flip (5*I - 10*O = 15 > 0)
O
I
I
O
-10
5
5
Synchronous Updating Example
Both upper neurons still want to flip (5*I - 10*I = -5 < 0).
This creates a cycle of length 2�in the state diagram.
The energy changes between�100 and -100.
I
I
I
I
-10
5
5
Attractors and Memories
Minimum energy states are known as attractors, because a running network will be attracted toward them.
Some, but not all, attractors will correspond to stored patterns, i.e. memories, in the network.
Other attractors will be spurious.
Basin of Attraction Concept
Attractors in a Continuous Version of a Hopfield Net: Neural “Flip-Flop”
(-1, 1) is minimum energy
(1, -1) is minimum energy
Hebbian Weight Assignment
yj
yi
wij
synapse
Generalized Hebbian Interpretation
yj
yi
wij
synapse
Switching Models
The {0, 1} model may be a good one for biologicaly modeling.
(It is also used in “sparse coding”.)
However, the {-1, 1} model tends to have fewer spurious minima.
We will use {-1, 1}, but call these values {O, I} (‘oh” and “eye”) for aesthetic reasons.
We can also use switch back and let O be 0 and I be 1 if we want.
Example
Suppose there are two patterns to be learned:
[I, I, O, O]
[O, O, I, I]
Weight Computation using Hebb Rule
Given a pattern Y as a column-vector, the weight change matrix contribution Δwij = yiyj for a pattern is the outer product � Y YT�which is an n x n matrix.
This computation is the same as for the linear associator.
However, after the contributions of the individual patterns is summed,
the diagonal weights are forced to 0.
For the example patterns [I, I, O, O], [O, O, I, I] this gives us the following weight matrix:
[[0, 2, -2, -2], [2, 0, -2, -2], [-2, -2, 0, 2], [-2, -2, 2, 0]]
Hopfield Net as Associative Memory
Stored Patterns Correspond to Attractors
Examples
For the example patterns [I, I, O, O], [O, O, I, I] using this weight matrix:
[[0, 2, -2, -2], [2, 0, -2, -2], [-2, -2, 0, 2], [-2, -2, 2, 0]]
here are some net simulations:
simulation from IIOO
0: IIOO Energy = -24
stable
simulation from OOII
0: OOII Energy = -24
stable
States corresponding to the example patterns are stable as desired.
Examples
For the example patterns [I, I, O, O], [O, O, I, I] using this weight matrix:
[[0, 2, -2, -2], [2, 0, -2, -2], [-2, -2, 0, 2], [-2, -2, 2, 0]]
Examples differing from patterns in one bit:
simulation from IIIO
0: IIIO Energy = 0
1: IIOO Energy = -24
stable
simulation from IIOI
0: IIOI Energy = 0
1: IIOO Energy = -24
stable
simulation from OIII
0: OIII Energy = 0
1: OOII Energy = -24
stable
Examples
For the example patterns [I, I, O, O], [O, O, I, I] using this weight matrix:
[[0, 2, -2, -2], [2, 0, -2, -2], [-2, -2, 0, 2], [-2, -2, 2, 0]]
Examples differing from patterns in two bits:�
simulation from IOIO
0: IOIO Energy = 8
1: IIIO Energy = 0
2: IIOO Energy = -24
stable
simulation from IOIO
0: IOIO Energy = 8
1: IIIO Energy = 0
2: IIOO Energy = -24
stable
Summary of this Example
For the example patterns [I, I, O, O], [O, O, I, I] using this weight matrix:
[[0, 2, -2, -2], [2, 0, -2, -2], [-2, -2, 0, 2], [-2, -2, 2, 0]]
The possible energies are 8, 0, -24 (from computation over all states).
Some states have more than one successor.
However, each state has a unique limit state.
The limit states are the stored patterns, with energy -24.
Analysis Code
Rather than conduct a bunch of simulations, we compute all of the limit states from a given state using depth-first search (relying on there being no cycles).
def limits(weight, state):
""" Returns the limits of a sequence of firings from a given state """
succs = successors(weight, state)
if succs == []:
return [state]
return union(map(lambda x:limits(weight, x), succs))
def successors(weight, state):
""" Returns a list of successors of the given state under weight matrix """
successors = []
i = 0
for neuron in weight:
successors += successor(neuron, state, i)
i += 1
return successors
Successor defined
For any state and any neuron, there can be a unique successor if the neuron is firable, or no successor if not. (Note that if tendency is 0, there is no successor.)
def successor(neuron, state, i):
""" Returns a list of 1 or 0 states, depending on whether the ith neuron """
""" (a vector of weights) fires or not. """
tendency = inner(neuron, state)
if state[i] < 0 and tendency > 0:
successor = copy.copy(state)
successor[i] = I
return [successor]
elif state[i] > 0 and tendency < 0:
successor = copy.copy(state)
successor[i] = O
return [successor]
return []
Checking for more than one limit
def limit_analysis(weight, states, patterns, columns, Is, Os):
""" For each state in states, checks whether there is more than one limit for """
""" that state and if so, the state and limits of the state are printed out. """
""" Each printout is given a sequence number. """
count = 0
for state in states:
stateLimits = limits(weight, state)
if len(stateLimits) > 1:
count += 1
print str(count) + ":", len(stateLimits), "limits:"
print show_list(weight, [state] + stateLimits, columns, Is, Os)
Letter Storage Example
In this example, there are 3 patterns as 35-element vectors.
We view them as 7x5 grids representing letters “H”, “M”, and “C”.
We compute a 35x35 weight matrix using the Hebb rule
The patterns with * as I and blank as O, with energies shown below, are:
Note that these patterns are definitely not orthogonal, so we do not expect this to work perfectly.
* *
* *
* *
*****
* *
* *
* *
(-1658)
* *
** **
* * *
* *
* *
* *
* *
(-1658)
***
* *
*
*
*
* *
***
(-1138)
The 35x35 Weight Matrix for HMC
[[0, -3, -3, -3, 3, 1, 1, -1, 1, 1, 1, -1, 1, -1, 3, 1, 1, 1, 1, 3, 1, -1, -1, -1, 3, 1, -1, -1, -1, 1, 3, -3, -3, -3, 3], �[-3, 0, 3, 3, -3, -1, -1, 1, -1, -1, -1, 1, -1, 1, -3, -1, -1, -1, -1, -3, -1, 1, 1, 1, -3, -1, 1, 1, 1, -1, -3, 3, 3, 3, -3], �[-3, 3, 0, 3, -3, -1, -1, 1, -1, -1, -1, 1, -1, 1, -3, -1, -1, -1, -1, -3, -1, 1, 1, 1, -3, -1, 1, 1, 1, -1, -3, 3, 3, 3, -3], �[-3, 3, 3, 0, -3, -1, -1, 1, -1, -1, -1, 1, -1, 1, -3, -1, -1, -1, -1, -3, -1, 1, 1, 1, -3, -1, 1, 1, 1, -1, -3, 3, 3, 3, -3], �[3, -3, -3, -3, 0, 1, 1, -1, 1, 1, 1, -1, 1, -1, 3, 1, 1, 1, 1, 3, 1, -1, -1, -1, 3, 1, -1, -1, -1, 1, 3, -3, -3, -3, 3], �[1, -1, -1, -1, 1, 0, -1, -3, -1, 3, 3, -3, -1, -3, 1, 3, -1, -1, -1, 1, 3, -3, -3, -3, 1, 3, -3, -3, -3, 3, 1, -1, -1, -1, 1], �[1, -1, -1, -1, 1, -1, 0, 1, 3, -1, -1, 1, 3, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1], �[-1, 1, 1, 1, -1, -3, 1, 0, 1, -3, -3, 3, 1, 3, -1, -3, 1, 1, 1, -1, -3, 3, 3, 3, -1, -3, 3, 3, 3, -3, -1, 1, 1, 1, -1], �[1, -1, -1, -1, 1, -1, 3, 1, 0, -1, -1, 1, 3, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1], �[1, -1, -1, -1, 1, 3, -1, -3, -1, 0, 3, -3, -1, -3, 1, 3, -1, -1, -1, 1, 3, -3, -3, -3, 1, 3, -3, -3, -3, 3, 1, -1, -1, -1, 1], �[1, -1, -1, -1, 1, 3, -1, -3, -1, 3, 0, -3, -1, -3, 1, 3, -1, -1, -1, 1, 3, -3, -3, -3, 1, 3, -3, -3, -3, 3, 1, -1, -1, -1, 1], �[-1, 1, 1, 1, -1, -3, 1, 3, 1, -3, -3, 0, 1, 3, -1, -3, 1, 1, 1, -1, -3, 3, 3, 3, -1, -3, 3, 3, 3, -3, -1, 1, 1, 1, -1], �[1, -1, -1, -1, 1, -1, 3, 1, 3, -1, -1, 1, 0, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1], �[-1, 1, 1, 1, -1, -3, 1, 3, 1, -3, -3, 3, 1, 0, -1, -3, 1, 1, 1, -1, -3, 3, 3, 3, -1, -3, 3, 3, 3, -3, -1, 1, 1, 1, -1], �[3, -3, -3, -3, 3, 1, 1, -1, 1, 1, 1, -1, 1, -1, 0, 1, 1, 1, 1, 3, 1, -1, -1, -1, 3, 1, -1, -1, -1, 1, 3, -3, -3, -3, 3], �[1, -1, -1, -1, 1, 3, -1, -3, -1, 3, 3, -3, -1, -3, 1, 0, -1, -1, -1, 1, 3, -3, -3, -3, 1, 3, -3, -3, -3, 3, 1, -1, -1, -1, 1], �[1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 0, 3, 3, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1], �[1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 3, 0, 3, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1], �[1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 3, 3, 0, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1], �[3, -3, -3, -3, 3, 1, 1, -1, 1, 1, 1, -1, 1, -1, 3, 1, 1, 1, 1, 0, 1, -1, -1, -1, 3, 1, -1, -1, -1, 1, 3, -3, -3, -3, 3], �[1, -1, -1, -1, 1, 3, -1, -3, -1, 3, 3, -3, -1, -3, 1, 3, -1, -1, -1, 1, 0, -3, -3, -3, 1, 3, -3, -3, -3, 3, 1, -1, -1, -1, 1], �[-1, 1, 1, 1, -1, -3, 1, 3, 1, -3, -3, 3, 1, 3, -1, -3, 1, 1, 1, -1, -3, 0, 3, 3, -1, -3, 3, 3, 3, -3, -1, 1, 1, 1, -1], �[-1, 1, 1, 1, -1, -3, 1, 3, 1, -3, -3, 3, 1, 3, -1, -3, 1, 1, 1, -1, -3, 3, 0, 3, -1, -3, 3, 3, 3, -3, -1, 1, 1, 1, -1], �[-1, 1, 1, 1, -1, -3, 1, 3, 1, -3, -3, 3, 1, 3, -1, -3, 1, 1, 1, -1, -3, 3, 3, 0, -1, -3, 3, 3, 3, -3, -1, 1, 1, 1, -1], �[3, -3, -3, -3, 3, 1, 1, -1, 1, 1, 1, -1, 1, -1, 3, 1, 1, 1, 1, 3, 1, -1, -1, -1, 0, 1, -1, -1, -1, 1, 3, -3, -3, -3, 3], �[1, -1, -1, -1, 1, 3, -1, -3, -1, 3, 3, -3, -1, -3, 1, 3, -1, -1, -1, 1, 3, -3, -3, -3, 1, 0, -3, -3, -3, 3, 1, -1, -1, -1, 1], �[-1, 1, 1, 1, -1, -3, 1, 3, 1, -3, -3, 3, 1, 3, -1, -3, 1, 1, 1, -1, -3, 3, 3, 3, -1, -3, 0, 3, 3, -3, -1, 1, 1, 1, -1], �[-1, 1, 1, 1, -1, -3, 1, 3, 1, -3, -3, 3, 1, 3, -1, -3, 1, 1, 1, -1, -3, 3, 3, 3, -1, -3, 3, 0, 3, -3, -1, 1, 1, 1, -1], �[-1, 1, 1, 1, -1, -3, 1, 3, 1, -3, -3, 3, 1, 3, -1, -3, 1, 1, 1, -1, -3, 3, 3, 3, -1, -3, 3, 3, 0, -3, -1, 1, 1, 1, -1], �[1, -1, -1, -1, 1, 3, -1, -3, -1, 3, 3, -3, -1, -3, 1, 3, -1, -1, -1, 1, 3, -3, -3, -3, 1, 3, -3, -3, -3, 0, 1, -1, -1, -1, 1], �[3, -3, -3, -3, 3, 1, 1, -1, 1, 1, 1, -1, 1, -1, 3, 1, 1, 1, 1, 3, 1, -1, -1, -1, 3, 1, -1, -1, -1, 1, 0, -3, -3, -3, 3], �[-3, 3, 3, 3, -3, -1, -1, 1, -1, -1, -1, 1, -1, 1, -3, -1, -1, -1, -1, -3, -1, 1, 1, 1, -3, -1, 1, 1, 1, -1, -3, 0, 3, 3, -3], �[-3, 3, 3, 3, -3, -1, -1, 1, -1, -1, -1, 1, -1, 1, -3, -1, -1, -1, -1, -3, -1, 1, 1, 1, -3, -1, 1, 1, 1, -1, -3, 3, 0, 3, -3], �[-3, 3, 3, 3, -3, -1, -1, 1, -1, -1, -1, 1, -1, 1, -3, -1, -1, -1, -1, -3, -1, 1, 1, 1, -3, -1, 1, 1, 1, -1, -3, 3, 3, 0, -3], �[3, -3, -3, -3, 3, 1, 1, -1, 1, 1, 1, -1, 1, -1, 3, 1, 1, 1, 1, 3, 1, -1, -1, -1, 3, 1, -1, -1, -1, 1, 3, -3, -3, -3, 0]]
One-Bit Error Correction
Computation shows that with only one bit of a letter altered, the network still stabilizes to the original letter, regardless of which bit is altered.
* *
* *
* *
*****
* *
* *
* *
(-1658)
* *
** **
* * *
* *
* *
* *
* *
(-1658)
***
* *
*
*
*
* *
***
(-1138)
limit analysis for no noise:
limit analysis for 1 level of noise:
(no output in either case, which is good)
limit analysis for 2 levels of noise:
(much output, see next slide)
Spurious Attractors
But with two bits of a letter altered, the network can stabilize in one of two different states, one of which will not be any of the original patterns.
These are called spurious attractors. Below we show some altered patterns for “H” and “M” and their possible limit states (with their energies). �For the altered “C”, there is always just one limit state. (Possible explanation?)
* ** | * * * *
* * | * * * *
* * | * * * *
** ** | ***** * *
* * | * * * *
* * | * * * *
* * | * * * *
(-1434)(-1658)(-1658)
** * | * * * *
** * | ** ** * *
* * * | * * * * *
* * | * * * *
* * | * * * *
* * | * * * *
* * | * * * *
(-1434)(-1658)(-1658)
Ways Spurious Attractors Arise
It can be seen that:
If a state is stable, then the negation of that state is also stable.
Ways Spurious Attractors Arise
It can be seen that:
The xor of any odd number of stable states is stable.
This generally means that there will be lots of stable states that are not original patterns.
Energy Explanation of Spurious Attractors (Hinton)
Two separate minima (purple and green) close to each other (patterns overlap significantly) merge to form a new minimum (red).
More on Minimizing Spurious Attractors
Hinton’s Explanation of Unlearning
Hopfield Storage Capacity
Standard wisdom (complicated proof) indicates a maximum pattern storage capacity of 0.14 times the number of neurons.
The actual capacity depends on the patterns stored, which may be less than this.
Hopfield Storage Capacity
N | N/(4 ln N) | .14 * N |
100 | 5 | 14 |
1000 | 36 | 140 |
10000 | 271 | 1400 |
100000 | 2171 | 14000 |
1000000 | 18096 | 140000 |
Space Efficiency Considerations
Hamming Net
1 pattern stored in each node
Identifies highest response in O(n) time
Neural “Movies”�(what if the weights aren’t symmetric?)
Neural “Movies”
“One only needs to modify the Hebb rule in the following manner:�
wi j = Σ pk i * p(k+1)(mod n) j (summation over all patterns)
to get temporal periodicity.”
…
“As a consequence, the network immediately makes a transition into the next pattern.”
Caveat: I haven’t gotten this to work as described.
Possible Application: Neural Network Anatomy in the Hippocampus CA3
Hippocampus plays important roles in the consolidation of information from short-term memory to long-term memory, and in spatial memory that enables navigation.
Neural Network Anatomy in the Hippocampus CA3
Recurrent Collateral: Neural Network Anatomy in the Hippocampus CA3
Coarse-Grain Model & Activity Levels of the Hippocampus
Diagram of Possible Auto-Associative Model of the Hippocampus
Commercial Successes with Hopfield Nets?
Using Nets to Find Solutions to Constraint Satisfaction Problems
Finding Solutions to the TSP �(Traveling Salesperson Problem) using a Hopfield Net
Traveling Salesperson Problem
TSP Encoding
means B occurs first on the tour, D occurs second, A third, E fourth, C fifth.
TSP Formulation
If one neuron is on, then others tend to be off, especially in minimum energy state.
TSP Formulation
TSP Formulation
TSP Formulation
For more details consult
TSP Formulation
The authors built a continous electronic version of the neural net and tried it on the TSP.
TSP Formulation
Comparison with an early state-of-the-art algorithm (Lin-Kernighan):
matlab demohop1 (continuous)
Analogy Between Hopfield Model and Ising Model of Magnetism