AI foundations · Lesson 3 of 3
AI foundations · Lesson 3 of 3
A model is only useful if its predictions are close to reality. To check, we compare predictions with actual values on examples the model has not seen. Testing on the same examples it learned from is like grading a student with the answer key they studied: the score looks great and means little.
A common, easy-to-explain measure is the mean absolute error (MAE): for each example, take the gap between actual and predicted, ignore the sign, and average the gaps. An MAE of 1.5 hours means the predictions are off by 1.5 hours on average.
Always compare against a simple baseline, such as predicting the average every time. A model that can’t beat it isn’t worth the extra complexity.
Write mae(actual, predicted), which returns the mean absolute error between two lists of the same length.
All checks pass. Well done.
You finished this course. All courses
An AI tutor that gives hints, not answers. It sees your code, its output and this lesson. It can be wrong.