BackpropagationLesson 1 of 6
One parameter at a time
Fixed observations, parameters, and a partial derivative
A model predicts 3 when the observed answer is 5. We want to change the model so its prediction gets closer. Which number should we change, and in which direction?
First, name the numbers
Section titled “First, name the numbers”Use the simple model . Read it as “multiply the input by w, then add b.” The hat on marks a prediction; is the observed answer.
| Quantity | Role | Starting value |
|---|---|---|
| Input observation, fixed here | 2 | |
| Target observation, fixed here | 5 | |
| Adjustable multiplier, a weight | 1 | |
| Adjustable offset, a bias | 1 |
The prediction is . Measure its error with the loss
Squaring makes errors in either direction contribute positively. The factor makes the derivative simpler. This is one chosen loss for one example.
Change w while holding b fixed
Section titled “Change w while holding b fixed”With and , the loss is a function of the two parameters:
Freeze . Expand the square so we can use ordinary derivative rules:
Its derivative is . At , that is −4. We write
Read this from the outside in: “at the current parameter values, how quickly does L change as w changes, holding b fixed?” The curly denotes a partial derivative. The bar after the expression says where to evaluate it.
The sign matters: increasing w a little should decrease the loss. The derivative is a rate. It is not the loss, the prediction, or an instruction to replace w with −4.
Check it with a small change
Section titled “Check it with a small change”Increase w from 1 to 1.01 and keep b at 1. The prediction becomes 3.02 and the loss becomes 1.9602.
| Compare | Change in loss |
|---|---|
| Local prediction: derivative × input change | |
| Actual change |
They are close because the step is small. The exact function has curvature; the derivative gives a linear prediction.
Your turn: change the bias
Section titled “Your turn: change the bias”Keep w at 1. What is at b = 1, and should increasing b help?
Work it through
With w fixed, . Its derivative in b is , which gives −2 at b = 1.
Increasing b by 0.01 predicts a loss change of −0.02. The actual prediction is 3.01 and the actual loss is 1.98005: a change of −0.01995. Increasing b a little helps here too.
Next: put the two partial derivatives together.