Skip to course content
Free course

Machine Learning Foundations / Module 3

Module 3 lesson

Residuals, Loss, and Why Errors Matter

Unit ID: ML-M03-U03 Estimated active time: 25-35 minutes

Why this matters

A model score is not just a number to celebrate.

It is a summary of errors.

If we do not inspect errors, we may miss the way a model fails.

The idea

For regression, one simple error is:

actual value - predicted value

This is called a residual.

If the actual quiz score is 80 and the prediction is 72, the residual is 8.

If the actual quiz score is 55 and the prediction is 68, the residual is -13.

The sign tells direction. The size tells how far off the prediction was.

Predict

Which prediction is worse?

Actual scorePredicted scoreAbsolute error
80728
556813

The second prediction is worse because it is farther from the actual score.

Run or inspect

Mean absolute error, or MAE, averages the absolute errors.

If MAE is 9.5 on quiz score, read it as:

On the test rows, the model is off by about 9.5 quiz-score points on average.

This is easier for beginners to understand than many other regression metrics.

Change one thing

What if two models have almost the same MAE?

Then the simpler model may be better for a first baseline. A tiny metric difference is not always meaningful.

Practice

In the worked notebook:

  1. Create a small table with actual and predicted quiz scores.
  2. Add an absolute_error column.
  3. Find the largest error in the sample.
  4. Write one sentence about what MAE means.

Check and explain

Complete:

MAE is useful because it is in the same units as ______.

Takeaway

Regression metrics summarize errors. Always connect the metric back to the real target units.