Neural Networks, lesson 5
The chain rule by hand
Work out each weight's gradient through a small network, step by step.
"Updating weights with gradients": training moves each weight against its slope, and you can estimate a slope by nudging the weight a hair.
Part 1. Rates multiply
A bakery turns flour into loaves and loaves into money. Each extra kilo of flour makes 4 more loaves. Each loaf sells for 3. So each extra kilo of flour brings in 4 × 3 = 12 more.
That's the whole idea behind backpropagation. When one quantity feeds the next, and that one feeds the next, the overall rate is the rates along the way multiplied together.
Your turn
Each extra kilo of flour makes 4 more loaves, and each loaf sells for 3. A quarter of every sale goes on rent. How much more rent does each extra kilo of flour bring in?
Chain rule
When a change passes through several steps, the overall rate is the product of each step's rate. In calculus these rates are called derivatives.
One piece of notation, because papers and docs use it everywhere. The rate at which the loss L changes when a weight w moves is written ∂L/∂w, and read "the slope of L with respect to w". The curly ∂ is a reminder that every other weight is held still while w moves.
Part 2. A tiny network, forward
Keep going with Pro
You've done the first part. Pro opens the rest of this lesson, and every other one.
- A tiny network, forward
- Backward, one link at a time
- Check it by nudging
Neural Networks overviewSpotted a mistake? Tell us.