Chapter 2 · Machine learning basics
Linear regression
Linear regression fits the straight line that best predicts a number from inputs.
Chapter 2 · Machine learning basics
Linear regression fits the straight line that best predicts a number from inputs.
waiting for points
Each new point nudges the best line. The red bars are the errors, and the best line makes them as small as possible overall.
Prediction = slope × input + intercept. We already met this model: two knobs, slope and intercept.
Tap the plot to add a point, tap a point to remove it, or paste x, y pairs (one per line, positive numbers) and press Fit pasted data.
y = 0.685·x + 1.632
R² near 100% means the line explains almost all the ups and downs; near 0% means a flat average would do as well. The fit is exact least squares, computed in your browser.
Linear regression predicts…
What makes a line the 'best fit'?
You add one dot far above the others. The line will…