Linear regression

Draw the best straight line through data, and pin down exactly what “best” means — squared residuals, a loss surface shaped like a bowl, and the probability model hiding underneath.

35 min

After this lesson you can

  • Write the linear model and absorb the bias into the weights with a column of ones
  • Explain three separate reasons for squaring the residuals, including the Gaussian-noise likelihood argument
  • Show that the squared-error loss is a convex bowl over the parameters, and read its contour plot
  • Say precisely what the “linear” in linear regression refers to

In this lesson

  1. Two mathematicians and a priority dispute
  2. The problem, stated precisely
  3. Residuals, and why we square them
  4. Where the square comes from: Gaussian noise
  5. The loss surface is a bowl
  6. “Linear” means linear in the parameters
  7. In code

This lesson is part of Descent Pro

Descent Pro unlocks every lesson on the route, from base camp to the summit. Every plan starts with a free trial.

Descent Pro

Start your free trial to keep reading

This lesson, and every other lesson on the route, is part of Descent Pro. Every plan starts with a free trial, and students with a .edu email get longer. Cancel before the trial ends and you pay nothing.