Each pixel is a neuron: white = active (+1), black = silent (−1). Every neuron is connected to every other neuron with symmetric weights (no self-connections) – a model of the recurrent collaterals of CA3.
Learning (Hebb rule, as in the MATLAB demo): for each stored image ξ with mean m, wij += (ξi − m)(ξj − m) / (n(1 − m²)), where n = N × N neurons. This is the MATLAB rule for 0/1 units, rewritten for ±1 units. Subtracting the mean stops similar images (letters are mostly white) from all looking alike to the network.
Recall: each neuron sums its input hi = Σj wij sj + b and becomes active if hi > 0, silent if hi < 0 (unchanged if exactly 0). The bias b is 0 in the classic network; the Brightness bias setting makes it the average brightness of the stored images. Energy E = −½ Σij wij si sj − b Σi si can only fall with asynchronous updates, so the network rolls downhill into a stable state (an attractor). Overlap with memory μ is (1/n) Σi ξμi si: +1 identical, 0 unrelated, −1 inverted.
Hopfield (1982) PNAS 79:2554; Amit, Gutfreund & Sompolinsky (1985) on capacity (≈ 0.14 n random patterns). Keyboard: Space run/pause, → step, S store, N add noise, H erase half, I invert, R random.