← Algo Playground
MACHINE LEARNING · SUPERVISED LEARNING

A line that learns from your data.

Place points, watch prediction errors shrink, and see gradient descent improve a straight-line model.

DATA & PREDICTIONS

ŷ = 0.000x + 0.500

y = slope × x + intercept
Observed dataModel lineResidual error┄ Exact least-squares fit

X and Y use a 0–1 scale. Editing data resets training. Up to 100 points. Use the form for precise or keyboard input.

Ready

EPOCH / POINTS0 / 20
MEAN SQUARED ERROR—
ROOT MEAN SQUARED ERROR—
R² SCORE—
LEARNING CURVE

Is the error getting smaller?

Loss is measured after each update. Axes rescale to the history; playback speed changes only the animation rate.

TRY A PREDICTION

What does the line predict?

Predictions can extend beyond the plotted 0–1 area.


One epoch, three actions.

  1. Predict: compute ŷ = mx + b for every point.
  2. Measure: MSE = mean((ŷ − y)²).
  3. Update: move slope and intercept against the loss gradient.

R² can be negative when the model is worse than predicting the mean. It is undefined when all observed Y values are equal. The dashed reference is the exact least-squares solution, not another training run.