Linear regression finds the straight line that best fits a set of data points. In our example, we are predicting house price (in millions) from size (in square meters).
The line is defined by two numbers:
Training is the process of adjusting these two numbers to reduce the cost – the average squared error between the line and the actual data points. Each iteration takes a small step to improve the fit.
More iterations usually lead to a lower cost and a more accurate line, but after a certain point, the improvement becomes tiny. The graph updates in real‑time, and you can see how the slope and bias evolve.
The R² score (0–1) tells you how well the line explains the data. 1.0 means perfect prediction; 0.0 means no better than guessing.
Try training with different iteration counts to see how the line converges. Reset to start over from the initial guess.