Lesson 3.1 · 6 min read · about 45 min to master at a very slow pace

Regression Fundamentals

Regression predicts a number from inputs. The model, the noise term, what "fitting" means, and how predictions are made, using house prices as a running example.

Not startedJump to quiz

The question regression answers

Regression predicts a quantitative response (a number) from one or more predictors . How much will this house sell for? What will CO concentration be at noon? How many patients will arrive next week?

1002003004005075100125150floor area (m²)price (£k)
Fitted line
Each dot is a house. The line summarises the trend: on average, more floor area means a higher price. The scatter around it is the noise the model can't explain.

Signal plus noise

Regression models assume the response is a systematic part plus random noise:

is the signal: the part of that depends on the predictors. is noise: everything else (unmeasured factors, measurement error, pure chance), assumed to average out to zero. Two houses with identical area and bedrooms still sell for different prices; that difference is .

Linear regression assumes is linear: .

Fitting and predicting

  • Fitting means estimating the unknown coefficients from training data, giving (lesson 3.3).
  • Fitted values are the model's predictions for the training points.
  • Predicting a new case means plugging its predictor values into the fitted equation: .
  • Residuals are the observed minus fitted values: how far each training point sits from the line.

Why start with linear regression?

It is the simplest useful ML model: fast, interpretable, with a closed-form solution and a full toolkit for uncertainty (standard errors, p-values, confidence intervals). Many ideas in the rest of the course (loss, overfitting, regularisation) are clearest here first.

Cheatsheet

Signal + noise

, . Linear regression: .

Residual

(observed − fitted). Positive → model under-predicted.

See every cheatsheet by category →

Check your understanding

Score 75% or more to master this lesson and earn XP. Answer first, then check.

Q1applyWhich of these is a regression problem?
Q2conceptIn the model , what does represent?
Q3calculateA house sold for £250k. The model's fitted price was £235k. What is the residual, and what does its sign mean?
Q4conceptHow are residuals related to the noise term ?
Q5calculateA fitted model is , where is floor area in m² and is price in £k. What's the predicted price of a 100 m² house?