Standard 3 stops to get here

Linear Regression

Predicting a number as a weighted sum of input features, with the weights chosen to minimize the squared error on training data.

Your route here

3 stops · basics first
  1. Machine Learning ✓ understood

    Building systems that learn patterns from data instead of following hand-written rules, getting better at a task as they see more examples.

  2. Supervised Learning ✓ understood

    Learning from examples paired with the correct answer, so a model can predict answers for new inputs it hasn't seen.

  3. Regression ✓ understood

    A supervised learning task where the model predicts continuous numerical values rather than discrete categories.

  4. Linear Regression · you are here ✓ understood

Linear regression is the simplest model for regression, and usually the first one worth trying. It predicts a number by multiplying each input feature by a weight, adding the results, and adding a constant. A house price model might learn that each extra square metre adds a fixed amount and each extra kilometre from the city centre subtracts one.

Training means choosing the weights. The standard choice, ordinary least squares, picks the weights that minimize the mean squared error between predictions and the true values on the training data. For this particular loss there is a closed-form answer, the normal equations, so the model can be solved directly. On very large datasets it is often fitted with gradient descent instead.

Why it still matters

A linear model is fast, hard to overfit when features are few, and readable: each weight says how much the prediction moves when that feature changes, holding the others fixed. That makes it a strong baseline and a common tool wherever a result has to be explained.

“Linear” refers to the weights, not the inputs. Adding squared or combined features lets the same method fit curves, and the model stays linear in its parameters. A single neuron with no activation function computes exactly this weighted sum.

Where it goes wrong

Squared error punishes large mistakes heavily, so a few outliers can drag the whole fit. When features are strongly correlated, individual weights become unstable and stop being trustworthy to read. Adding a penalty on the weights, as in ridge regression (L2) or the lasso (L1), is the usual fix. R-squared is the common summary of how much of the variation the fit explains.

Where it sits

Before this

Regression
Linear Regression

Leads to

Nothing yet: a destination in its own right.

Explore nearby

Sources

  1. Ian Goodfellow, Yoshua Bengio and Aaron Courville, Deep Learning . MIT Press, 2016; section 5.1.4, Example: Linear Regression
  2. scikit-learn User Guide, Linear Models: Ordinary Least Squares . Official documentation