Curvingo · Made in India

Glossary

Select one of the keywords on the left…

Linear RegressionSummary

Reading time: ~5 min

One page to revise from — the ideas first, then every formula you need.

  • Linear regression predicts a number (the target y) from one or more features x with a straight line \hat{y} = mx + c.
  • Training means finding the slope and intercept that make the loss as small as possible; predicting means putting a new x into the line.
  • The error (residual) of a point is y - \hat{y}. 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 (\bar{x}, \bar{y}).
  • A coefficient is the change in \hat{y} 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
\hat{y} = mx + c

Mean squared error
\text{MSE} = \dfrac{1}{n} \sum (y_i - \hat{y}_i)^2

R-squared
R^2 = 1 - \dfrac{\text{MSE of model}}{\text{MSE of average}}

Gradient descent step
m_{\text{new}} = m - \alpha \dfrac{dE}{dm}

Least-squares line
m = \dfrac{\sum (x - \bar{x})(y - \bar{y})}{\sum (x - \bar{x})^2}, \qquad c = \bar{y} - m\bar{x}

Sina