Gradient Updates and Loss
The model's warning score is too high for an on-time delivery.
Read the full lesson and open its transcript below. A narrated video will be added after production.
What you will learn
The model's warning score is too high for an on-time delivery.
A practical question
The model assigns a high late score to a trip that arrived on time. A loss function tells us how costly that prediction was under the chosen training objective. The gradient tells us how the loss changes locally when each model parameter changes.
The useful idea
A small step opposite that gradient generally aims to reduce loss nearby. The learning rate controls the step size. Too large a step can overshoot; too small can make learning painfully slow. One example's update need not improve every other trip, so we watch performance over training and validation sets.
Work through the example
Take one parameter and perturb it slightly. Does the loss move in the direction the gradient suggests? Then compare several learning rates on the same training data without touching the final test period. A gradient points toward a local increase in a chosen loss, so a small step in the opposite direction should usually lower it near the current setting. Check this on a tiny numerical example before trusting a training run. If the step is too large, the loss can rise or oscillate. Compare training and validation behavior as optimization proceeds. A falling training loss tells us the model is fitting its examples; it does not prove that the delivery decisions generalize. Use this case to test your understanding: Compare the sign of one gradient with the change in loss after a small update. Here is the limitation to watch for: A large step can overshoot, and a lower training loss is not enough by itself. This supports a careful conclusion: Gradient-based learning changes parameters in the direction that reduces a differentiable loss locally. If a small gradient step raises the loss instead of lowering it, check the derivative, units, and step size on a tiny example. Only after that local check should you interpret a full training curve. A lower loss must still be connected to useful held-out warnings.
Limits and next step
Next, we'll decide when the added flexibility of a neural model is worth its cost for tabular deliveries.
Worked example
Compare the sign of one gradient with the change in loss after a small update.
Quick check: test your understanding
Try it yourself: Consider this case: Compare the sign of one gradient with the change in loss after a small update. Explain how you would check the result. In your answer, address this limitation: A large step can overshoot, and a lower training loss is not enough by itself.
Check the reasoning
Gradient-based learning changes parameters in the direction that reduces a differentiable loss locally. A large step can overshoot, and a lower training loss is not enough by itself.
What is the main idea behind gradient updates and loss?
Gradient-based learning changes parameters in the direction that reduces a differentiable loss locally.
How is it used in the example?
Compare the sign of one gradient with the change in loss after a small update.
What limitation should be checked?
A large step can overshoot, and a lower training loss is not enough by itself.
Further reading
Machine Learning — Tom M. Mitchell.
Original ToolsInVision teaching examples. Editorial approach · Suggest a correction
Accessible referenceLesson 54 transcript332 words · Narration ready for the upcoming videoOpen transcript
The model assigns a high late score to a trip that arrived on time. A loss function tells us how costly that prediction was under the chosen training objective. The gradient tells us how the loss changes locally when each model parameter changes.
A small step opposite that gradient generally aims to reduce loss nearby. The learning rate controls the step size. Too large a step can overshoot; too small can make learning painfully slow. One example's update need not improve every other trip, so we watch performance over training and validation sets.
Take one parameter and perturb it slightly. Does the loss move in the direction the gradient suggests? Then compare several learning rates on the same training data without touching the final test period. A gradient points toward a local increase in a chosen loss, so a small step in the opposite direction should usually lower it near the current setting. Check this on a tiny numerical example before trusting a training run. If the step is too large, the loss can rise or oscillate. Compare training and validation behavior as optimization proceeds. A falling training loss tells us the model is fitting its examples; it does not prove that the delivery decisions generalize. Use this case to test your understanding: Compare the sign of one gradient with the change in loss after a small update. Here is the limitation to watch for: A large step can overshoot, and a lower training loss is not enough by itself. This supports a careful conclusion: Gradient-based learning changes parameters in the direction that reduces a differentiable loss locally. If a small gradient step raises the loss instead of lowering it, check the derivative, units, and step size on a tiny example. Only after that local check should you interpret a full training curve. A lower loss must still be connected to useful held-out warnings.
Next, we'll decide when the added flexibility of a neural model is worth its cost for tabular deliveries.