Module 3 · Lesson 1 of 510/56 in the course~18 min
Module lessons (1/5)
Fitting a line
Lesson preview5 hands-on exercises readyMachine Learning: from first principles to practice · Module 3 — Linear regression and gradient descent
Parameters, predictions, residuals and the MSE and MAE loss functions.
What you'll learn in this lesson
- Describe a line as a model with two parameters.
- Compute predictions, residuals and the mean squared error.
- Explain why MSE and MAE react differently to large mistakes.
Overview
Suppose you know the size of some houses and what they sold for, and you want to predict the price of a new one. If the points roughly follow a straight line, the simplest model is that line:
The slope says how much the prediction changes per unit of x; the intercept is the prediction when x is 0. These two numbers are the model's parameters. Learning means choosing them well.
Sections covered in this lesson
- 1The hook: predicting a number from a number
- 2Try it: fit a line by hand
- 3Residuals and loss
- 4Comparing MAE vs. MSE
- 5Practice
- 6Check your understanding
Pro Lesson · Module 3 — Linear regression and gradient descent
Unlock "Fitting a line" and the full Machine Learning: from first principles to practice curriculum
Parameters, predictions, residuals and the MSE and MAE loss functions.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Machine Learning: from first principles to practice plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.