Foundations · /linear

Linear regression

Fit ŷ = wx + b by gradient descent. The red segments are the residuals the loss sums over; the Internals tab shows descent rolling down the actual loss surface toward the normal-equation optimum (dashed line).

curve 120 samples · seed 42
datafilled = train, hollow = testhover to probe · click to pin
step 0MSE train RMSE test RMSE

Data

datasetpoints150noise0.15seedsplitmouse
Model
Mean squared error
Each squared term is the length of a residual segment on the plot, squared.
Gradient descent update
Where it converges (normal equation)
Gradient descent walks toward this point; it is marked on the loss surface.
What's simplified here
  • Nothing material — this is textbook least squares. The normal equation shown uses the ridge form with an unpenalized intercept, matching the gradient exactly.
  • Mini-batch mode reshuffles once per epoch with the page seed, so runs stay reproducible.