A stall sells apples and bananas and charges a small bag fee. We only have receipts. One neuron will work out the prices from the receipts alone, one small calculation at a time.
Green = numbers flowing forward (left to right). Red dashed = blame flowing backward (right to left). Yellow = the thing being computed right now.
Keyboard: → or space for Next, ← for Back.
The network was never shown this receipt. The true answer uses the hidden rule 2·apples + 1·bananas + 1, which the network never sees.
Start: w₁ = 1, w₂ = 1, b = 0. Learning rate η = 0.1. Parameters are rounded to 4 decimals after each update, so the numbers you see are exactly the numbers used.
| # | apples | bananas | paid |
|---|
The network sees only these four rows. It cycles through them in order. One pass over all four is one epoch.
| step | ŷ | error | loss | w₁ | w₂ | b |
|---|
Nothing trained yet. Weights shown are the values after each update.
z = w₁·x₁ + w₂·x₂ + b
ŷ = ReLU(z) = max(0, z)
L = ½ (ŷ − y)²
δ = (ŷ − y) · ReLU′(z)
∂L/∂w₁ = δ · x₁
∂L/∂w₂ = δ · x₂
∂L/∂b = δ · 1
w ← w − η · ∂L/∂w
η = 0.1
ReLU′(z) is 1 when z > 0 and 0 otherwise. With these receipts the neuron is always active, so the derivative is always 1.