AI Launch Lab
Sign in FR Get updates

AI foundations · Lesson 3 of 3

Is the model any good?

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.

Your turn

Write mae(actual, predicted), which returns the mean absolute error between two lists of the same length.

Loading Python (about 12 MB, once)…

    Checks

    • ○ perfect predictions give 0
    • ○ errors above and below both count
    • ○ a single example

    Output

    ← Previous lesson All courses