Ready Click Step to start forward pass
Math:
hidden 1 · z₁ = w₁₁x₁ + w₁₂x₂ + b₁
0.5·1.5 + 0.2·(−2) + 0.1
hidden 1 · a₁ = σ(z₁)
1 / (1+e−z₁)
hidden 2 · z₂ = w₂₁x₁ + w₂₂x₂ + b₂
0.3·1.5 + (−0.4)·(−2) −0.2
hidden 2 · a₂ = σ(z₂)
1 / (1+e−z₂)
output · ŷ = wo₁a₁ + wo₂a₂ + b₀
0.8·a₁ −0.5·a₂ + 0.2
loss · L = ½(ŷ − y)²   · δ = ŷ − y
error signal for chain rule
Gradients · dL/dw = (downstream blame) × (upstream value)   Every weight has its own local formula.
weightvaluegradient ∂L/∂wnew w ← w − η·grad

Step

0 / 14

Forward Chain

x → z → a → ŷ → L

Cook Analogy

Taster hasn't tasted yet

Learning

Click "Step" or "Play" — we'll walk forward then send blame backwards via the chain rule.
Forward (weighted sum)
Activation σ
Loss / error
Backward blame
Analogy: team of cooks guessing a secret recipe. Input = ingredients (x₁, x₂). Each hidden neuron = a cook who mixes ingredients with their own weights, then applies an allergy filter σ. Output = head chef who plates ŷ. Taster = loss L says "too salty by δ". The head chef knows he used 0.8 of cook-1's sauce → passes blame δ·0.8 back. Each cook multiplies incoming blame by their own filter slope σ′ and then by ingredient amount — that's the chain rule, no global guesser.
Python — forward & backward
# forward — nested functions
z1 = w11*x1 + w12*x2 + b1
a1 = sigmoid(z1) # σ(z)=1/(1+e^{-z})
z2 = w21*x1 + w22*x2 + b2
a2 = sigmoid(z2)
y_hat = wo1*a1 + wo2*a2 + b0 # linear output
loss = 0.5 * (y_hat - y_true)**2
# backward — chain rule
dL_dy = y_hat - y_true # δ
dL_dwo1 = dL_dy * a1; dL_dwo2 = dL_dy * a2
delta1 = dL_dy*wo1 * a1*(1-a1) # blame × σ′(z1)
dL_dw11 = delta1*x1; dL_dw12 = delta1*x2
delta2 = dL_dy*wo2 * a2*(1-a2); dL_dw21=delta2*x1 …
for w in weights: w -= lr * dL_dw