Enrichment · STEM Explorations · Gradient descent on a bowl you set
Gradient descent walks downhill by repeating one step: move against the slope by a fraction of its size. On the bowl f(x) = a(x − m)² + c, each step shrinks the distance to the bottom by a fixed factor 1 − 2a × step. Give the bowl, the start, the step size and the number of steps. The page shows where you land, the factor, the step size that finds the bottom fastest and how many steps get within a tolerance.
The worked example is f(x) = 2(x − 3)² + 1 starting at 10 with step size 0.2, five steps, tolerance 0.001. Nothing you type leaves this browser.
Loading the calculator. If nothing appears, turn on JavaScript.
One variable, a fixed step size. The example is made up.
Enrichment · STEM ExplorationsOpen to everyone · no sign-in
One factor rules every step.
On a perfect bowl the slope is proportional to the distance from the bottom, so every step removes the same fraction of that distance. That fraction is 1 minus twice the steepness times the step size. When it lies between −1 and 1 the walk converges, and when it is 0 the walk lands at once.
The same trade-off shows up in training machine learning models, where a learning rate that is too small is slow and one that is too large makes the loss grow. Real functions are not bowls, so this sandbox is the starting picture, not the whole story.
Figures worked from your own numbers. Nothing you type is sent to Caveat. The worked example is made up. Your entries stay in this browser. Support: team@caveatacademic.com.