Linear RegressionSummary
One page to revise from — the ideas first, then every formula you need.
- Linear regression predicts a number (the target ) from one or more features with a straight line .
- Training means finding the slope and intercept that make the loss as small as possible; predicting means putting a new into the line.
- The error (residual) of a point is . Errors are squared so that positive and negative misses do not cancel.
- MSE is the average squared error; R² compares the model with always guessing the average (1 is perfect, 0 is no better, below 0 is worse).
- Gradient descent reaches the bottom of the error valley by stepping against its slope; the learning rate sets the step size — too small is slow, too big flies off.
- For a straight line there is also an exact formula, and the best line always passes through .
- A coefficient is the change in for a 1-unit rise in its feature, with every other feature held fixed. Do not trust a line far outside the range of its data.
Model
Mean squared error
R-squared
Gradient descent step
Least-squares line