Take every possible choice of a line's parameters, compute the
That single fact is what makes training a line so friendly, and it's the picture that turns the abstract idea of "minimise the cost" into something you can literally see: training a model is just rolling a ball downhill until it settles at the bottom of that bowl.
It's worth pausing on how strange that is. The cost function itself never mentions a bowl, a hill, or a ball — it's just a sum of squared numbers. The bowl shape is a hidden geometric consequence of that formula, one that only reveals itself once you plot cost against parameter value. Spotting that hidden shape is exactly what turns "guess and check" into a real optimisation strategy.
Hold the bias
Let's see that U-shape appear from real numbers, not just imagine it.
Recall the four students from the
Compute the cost
Lay those five numbers out —
The bottom of the bowl is the weight that fits the data best; anywhere else, up the sides, the
line is worse and the cost is higher. The steepness of the wall right beside the dot is a hint
about which way to go to make the cost smaller — walk downhill, in the direction the slope points
— which is exactly the idea the next page turns into a precise algorithm,
Notice something else the shape guarantees: the further the dot sits from the bottom, the steeper the wall tends to be, and the closer it gets, the flatter the curve becomes — right at the very bottom the curve is momentarily flat, neither rising nor falling. That flatness at the minimum isn't a coincidence; it's the mathematical signature of "this is as good as it gets", and it's exactly the condition an algorithm can test for to know when to stop searching.
With both
Real models have millions of parameters, so their "bowl" lives in a million-dimensional space no one can actually picture. But the principle never changes: find the lowest point of the cost surface, however many dimensions it happens to have.
Here is that two-parameter cost
The one-parameter table above fixed
Sliding
This is exactly why the full two-parameter search matters in practice: fixing one knob and
perfecting the other only ever finds the best point on that one slice of the bowl, like
exploring a single street instead of the whole city. A search that's free to move diagonally —
adjusting
It's tempting to assume every model's cost surface looks this friendly. It doesn't. The
single-bottomed bowl shape is a direct consequence of the mathematics of mean squared error being
convex for a straight-line hypothesis — a special, provable property, not a
universal law of cost functions. Change the model and that guarantee can vanish completely: a
Once you know what to look for, a contour plot becomes a genuine map-reading skill. Where the rings are drawn tightly packed, close together, the cost is changing rapidly as you move — a steep slope, like the tightly bunched contour lines on the side of a real mountain. Where the rings are widely spaced, spread far apart, the cost barely changes as you move — a shallow, gently sloped region, like the wide gaps between contour lines on a flat plain. A ball rolling down a cost landscape accelerates fastest where the rings crowd together, and crawls where they spread out — exactly how gravity would pull a real ball down a real hill drawn on that same map.
This bowl is one of the single most reused images in all of machine learning teaching, and for good reason: it takes something entirely abstract — "search over an infinite space of possible parameter values for the one combination that minimises a formula" — and turns it into something you can point at and just see. There's a nice etymological joke buried in the name, too: a contour map of cost is put together exactly like a topographic map of real hills, and gradient descent quite literally means "walking downhill" — the same phrase you'd use standing on an actual mountainside, borrowed wholesale for an algorithm that has never seen a mountain.
It even works as a mnemonic for the trap in the "Watch out!" box above: a real hiker walking downhill from wherever they happen to start will end up at whichever dip is nearest — the bottom of the nearest valley, not necessarily the lowest point in the whole mountain range. Linear regression's bowl is special precisely because it only has the one valley, so "nearest dip" and "best possible dip" are always guaranteed to be the exact same place.