liveBook · Manning

Mean absolute error

As explained in Grokking Machine Learning, Second Edition

A regression metric equal to the average absolute difference between predicted and observed numerical values.

When a model predicts house prices, each prediction may miss the observed price by a different amount. Mean absolute error (MAE) summarizes those misses as one average distance from the predictions to the observed values. section 3.23

Calculate the absolute error for every prediction, add those errors, and divide by the number of predictions: MAE = (|e₁| + |e₂| + ⋯ + |eₙ|) / n. Averaging makes errors more comparable across datasets with different numbers of points. section 3.23

Practice with house prices

Use the house-size and price data to calculate the model’s predictions, then calculate its mean absolute error. Compare the result with the root mean square error as a second view of prediction error. section 3.38

 
Size (s)
Prize (p)
House 1
100
200
House 2
200
475
House 3
200
400
House 4
250
520
House 5
325
735

Use the house-size and price table as the dataset for the error-calculation exercise. section 3.38

How Grokking Machine Learning, Second Edition covers it

How deep it goes
Defines averaged absolute distances and motivates dataset-size comparability, but does not detail implementation.
Examples
Uses house-price prediction and a house size–price dataset for calculating MAE and RMSE.
What it assumes
Assumes predicted and observed numerical values, while explaining averages through dataset-size comparisons.
What you can do after
Evaluate a regression model by calculating its average absolute prediction error.
How it connects
Connects regression error with mean square error, root mean square error, and linear regression.

Also explained in

Compare how 15 books explain mean absolute error →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning, Second Edition. The section links point to the parts of the book it draws on.