Lesson 4 — Prediction by average
The simplest model: always guess the average
A baseline is a deliberately dumb model you compare everything against. The classic baseline for numbers ignores the input and always predicts the mean of the training data (the data the model learns from). We judge it with the mean absolute error (MAE): the average of how far each prediction is from the real value, ignoring the sign.
abs(20 - 25) # 5 — abs() drops the minus sign
Why it matters: if your fancy model cannot beat "always guess the average", it has learned nothing useful. Always measure a baseline first.
Compute pred (the mean of train) and mae (the mean absolute error on test). Expected: prediction 20.0, error 3.0.
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
A quick 3-question quiz on this lesson — instant feedback.