“Neurons that fire together, wire together.” The rule is almost embarrassingly simple: the weight between two units tracks how correlated their activity is. Slide the correlation (or tap) from anti- to in-phase and watch the wire between them strengthen, vanish, or invert.
Hebbian learning on two units. The correlation ρ = 2·(slider) − 1 runs from −1 to +1; 200 activity samples are drawn with that correlation (aⱼ = ρ·aᵢ + √(1−ρ²)·noise) and the learned weight is the measured covariance Δw ∝ ⟨aᵢaⱼ⟩ − a Hebbian outcome. Positive ρ → a strengthening (excitatory) edge; ρ=0 → no change; negative ρ → an inverted (inhibitory) edge. A fail-loud self-check throws unless the weight is positive at ρ=+1, ~0 at ρ=0, and negative at ρ=−1.
Two units and a linear correlation stand in for a network of many; real Hebbian rules add normalisation (Oja) to stop runaway weights. The sample correlation and the covariance weight are computed exactly.