A Hopfield network is a model to represent an Artificial Neural Network. It is a type of Recurrent Neural Network.
It relies on a given corrupted input, , which is pulled towards an attractor, to the nearest stable, memorised fixed point, through time, similar to a potential field.
It does this through Associative Learning.
Example
We will consider a discrete Hopfield network over a pattern. We define each element that characterises the state of a neuron . Therefore, (for a Bipolar pattern)*.
As the network is a type of Recurrent Neural Network, it has feedback loops (but without self-loops), creating a complete graph. Hence, consider a Hopfield network with 4 neurons ():

* We assume binary patterns are used throughout. Binary patterns use 0 instead of -1.
Learning
See Hebbian Theory and Outer Product
Hopfield networks learn through the Hebbian learning rule. Given an edge connecting two nodes (neurons) , we have .
Hence, we can form a weight matrix for the example pattern vector with 4 neurons (4 cells):
We can represent this with the vector , with corresponding to black cells and , white cells.
Hence, we find as:
Multiple Patterns
We may also define over multiple patterns. This is the average of the sum of their matrices. Namely,
Training
The Hopfield network is trained by updating the states of each neuron at every time iteration, until a stable state is reached.
Namely, we can describe the state of the set of neurons at a given time as:
\vec{s}(t+1) = F(W \cdot \vec{s}(t)) $$Given the [[Activation Function\|activation function]], $F$, for which we will use the $sgn$ function for bipolar patterns:\text{sgn}(x)= \begin{cases} 1&, x \ge 0 \ -1&, x < 0 \end{cases}
\vec{x} = \text{sgn}(W \cdot \vec{x})