AI Grounds

Open AI Grounds on a desktop

These interactive lessons need a larger screen. Please continue on a desktop or laptop computer.

Guided discovery

Least Squares Loss Landscape

Move two parameters; compare squared error across lines.

Your parameter pair

One diamond represents one whole line for five fixed toy observations. Click or drag the parameter plane, or use the Slope and Intercept controls below.

Slope 0.0 · Intercept 6.0 · SSE 36.00. Your line: ŷ = 0.0X + 6.0. Signed residual sum −12.00.

-101202468InterceptSlope

Diamond = your line; star = minimum reference at (0.8, 2). Contours connect equal SSE at 1.2, 2.4, 5, 20, 80 and 200. At the minimum the two markers coincide; the diamond remains draggable.

0.802.4020.0080.00368.00

Color samples use a fixed compressed scale to distinguish small costs. Read exact SSE at your pair; neither color nor contours are probabilities.

Horizontal coordinate of the parameter point. Predicted Y change per one X unit. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.

Vertical coordinate of the parameter point. Predicted Y at observed X = 0. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.

SSE = sum of five squared vertical residuals = 36.00. Signed residual sum = −12.00. Above minimum = 35.20.

The map axes are model coefficients, not the observations’ X/Y coordinates. The fixed observed pairs are (0,2), (1,3), (2,3), (3,5), (4,5). Residual = observed Y minus predicted Y at the same X; squaring makes every contribution nonnegative.

Your SSE

Squared vertical residuals for this parameter pair.

36.00

Σ[observed Y − (Slope × X + Intercept)]²

Minimum SSE

Best straight line for these varied-X observations.

0.80

Slope 0.8 · Intercept 2.0

One joint minimum; positive error need not vanish.

A low SSE describes fit to these five fixed toy pairs. It does not establish causation or guarantee accuracy on new observations. Other models and losses can have different landscapes.

Pair and squared-residual table
The observations stay fixed. Each prediction comes from the current diamond’s line.
PointXObserved YPredicted YResidualSquared
1026.00−4.0016.00
2136.00−3.009.00
3236.00−3.009.00
4356.00−1.001.00
5456.00−1.001.00
Current line and residuals

This optional chart uses observed X/Y axes, separately from the Slope/Intercept parameter plane. Indigo line = current prediction; circles = fixed observations; orange segments = vertical residuals.

01234-40481216YX
Why one minimum?

For this fixed dataset, the exact identity is SSE = 0.8 + 10(m − 0.8)² + 5[b − 2 + 2(m − 0.8)]². Here m means Slope and b means Intercept. The last two terms are nonnegative; both vanish together only at m = 0.8 and b = 2.

Current excess: 6.40 + 28.80 = 35.20 above the 0.80 floor.

The factor 10 is the sum of squared X departures from mean X = 2; the factor 5 is the observation count. The final bracket is predicted Y at X = 2 minus mean Y = 3.6. Balancing that mean alone leaves the slope term. The identity proves a unique minimum over all real coefficient pairs, not only the displayed tenths grid. This uniqueness depends on the varied X values and this straight-line least-squares model.

Conventions and sources

The color function uses log(1 + SSE) on a fixed 0–368 scale, compressing larger values; displayed color samples give actual SSE values. Heatmap cell-center colors provide an overview, while the current point and tables use exact full-precision residual sums before two-decimal display. Contours are analytical transformed circles at the stated SSE levels, clipped only to the visible coefficient window. The star’s coefficients come from the ordinary least-squares formulas.

There is no normality requirement for this descriptive minimization. Degenerate designs, other model families, optimization algorithms, R² diagnostics, causality and held-out performance are outside this lesson. The minimum’s residuals need not all be zero.

NIST · Least-squares criterion and coefficients
Illinois CS 357 · Uniqueness and the least-squares objective