11.3 Training and backpropagation
Source: Ideas from Computational Physics (Landau, Páez, Bordeianu), §11.2.3–11.2.5. Rewritten in original wording — no textbook
SimpleNet.pydump. Continues 11.2b. Next: 11.3b.
Teach with known answers
Feed training pairs with known correct outputs . Compare to predictions . Define Loss, nudge weights with derivatives (backpropagation), then repeat. Pick MSE, the SGD step, and the logistic identity among lookalikes.
Finally evaluate on unseen data. Trained nets are efficient pattern engines but poor explainers: the parameter soup rarely narrates why a decision was made (hence the Blueprint quote in §11.1).
Meson-track toy
Classify () vs () from track length/width. Mean-center features (length mean , width mean ):
| ID | Length | Width | Label |
|---|---|---|---|
| A | () | ||
| B | () | ||
| C | |||
| D |
If the net always predicts , then on these four labels — right half the time by chance.
Gradients via the chain rule
Extremize in the weights/biases (six 's and three 's even in the tiny 2–2–1 net): seek and . In practice, compute gradients and take the SGD steps you picked above.
Example (book walk-through style): one sample with , , , all weights , biases :
Then
(positive ⇒ decrease to lower ). Sweep parameters one-at-a-time or in batches until stalls.
Practice checklist
- Implement MSE Loss; check for all-zero predictions on the four labels.
- Forward the all-ones-weight net on ; lock .
- Compute and ; apply one SGD step and re-forward.
- (Open) Train a 2–2–1 net on all four tracks; try 3 hidden nodes or two hidden layers and compare final .
Takeaway
| Step | Action |
|---|---|
| Forward | Predict |
| Loss | MSE vs |
| Backward | Chain-rule |
| Update | |
| Test | Unseen tracks / holdout |
Training / backprop
1 / 4MSE Loss averages…
Pick an answer to see if you are right.
Next: 11.3b Training labs.