Labs / Neural Network LabBackpropagation, step by step
A one-neuron classifier: edit the inputs and weights and recompute all nine steps.
Theory and worked examples: Backpropagation
- 1. Weighted sumz=w1x1+w2x2+b=0.5000⋅2.0000+(−1.0000)⋅1.0000+0.0000z=0.0000
- 2. Sigmoid outputy^=σ(z)=1+e−0.00001y^=0.5000
- 3. Binary cross-entropyL=−[ylogy^+(1−y)log(1−y^)]L=0.6931
- 4. Error signal∂z∂L=y^−y=0.5000−1−0.5000
- 5. Gradient for w₁∂w1∂L=∂z∂Lx1=(−0.5000)⋅2.0000−1.0000
- 6. Gradient for w₂∂w2∂L=∂z∂Lx2=(−0.5000)⋅1.0000−0.5000
- 7. Gradient for b∂b∂L=∂z∂L⋅1−0.5000
- 8. Update (η = 0.1)w1=0.5000−0.1⋅(−1.0000),w2=(−1.0000)−0.1⋅(−0.5000),b=0.0000−0.1⋅(−0.5000)0.6000,−0.9500,0.0500
- 9. New predictionz′=0.6000⋅2.0000+(−0.9500)⋅1.0000+0.0500=0.3000y^′=0.5744
Why is step 4 so simple? ∂y^∂L=y^(1−y^)y^−y and ∂z∂y^=y^(1−y^). Multiplying them (the chain rule), the y^(1−y^) terms cancel.