Hopfield Network - 2 Neurons

Understanding the Learning Phase and the Execution Phase
Phase 1: Learning
In this phase you choose which patterns the network will remember.
The weight Jij is calculated based on the selected patterns.
Jij = 0.00 A − B −

Select patterns to store:

Weight calculation:

Jij = (1/N) × Σ piμ × pjμ
Jij = 0

Energy surface (varies by patterns):

Scan by sliders (Extension):
+1.00
+1.00
Phase 2: Execution
Learning is complete. Jij is fixed and does not change.
Now select an initial state and the network converges to a minimum.
Jij = 0.00 A +1 B +1
The weight Jij is locked — no longer changes

Select current state:

Energy at current state:

E = 0

Energy surface (fixed):

State (A, B) Energy E Stored pattern?
Energy Calculation — Formulas
1 Weight formula (Hebbian Learning):
Jij = 1 N ∑Pμ=1 piμ · pjμ    (i ≠ j)
Jii = 0    (No self-connection)
2 Weight calculation Jij:
Jij = 1 2 × [(+1.00) · (+1.00)] = +0.50
3 Energy formula:
E = − 1 2 ∑i ∑j≠i Jij · si · sj
4 Substitution and calculation:
E = − 1 2 × [Jij·si·sj + Jji·sj·si]
= − 1 2 × [(+0.50)·(+1)·(+1) + (+0.50)·(+1)·(+1)]
5 Final result:
E = − 1 2 × (+1.00) = −0.50
E = −0.50
Weight matrix Jij:
Jij j=1 j=2
i=1 0 +0.50
i=2 +0.50 0
Scan by sliders (Extension):
6 Weight calculation by slider values:
Jij = 1 2 × [(+1.00) · (+1.00)] = +0.50
7 Substitution and calculation by sliders:
E = − 1 2 × [Jij·si·sj + Jji·sj·si]
= − 1 2 × [(+0.50)·(+1.00)·(+1.00) + (+0.50)·(+1.00)·(+1.00)]
E Result by sliders:
E = − 1 2 × (+1.00) = −0.50
E = −0.50