MAE (Mean Absolute Error) is a popular metric to use for regression machine learning models, but what is a good score? In this post, I explain what MAE is, what a good score is, and answer some common questions.
What is MAE?
MAE (Mean Absolute Error) is the average absolute error between actual and predicted values.
Absolute error, also known as L1 loss, is a row-level error calculation where the non-negative difference between the prediction and the actual is calculated. MAE is the aggregated mean of these errors, which helps us understand the model performance over the whole dataset.
MAE is a popular metric to use as the error value is easily interpreted. This is because the value is on the same scale as the target you are predicting for.
MAE mathematical formula
The formula for calculating MAE is as follows:
How to calculate MAE in Python
Calculating MAE is simple to implement in Python using the scikit-learn package. An example can be seen here:
from sklearn.metrics import mean_absolute_error actual = [100,120,80,110] predicted = [90,120,50,140] mae = mean_absolute_error(actual, predicted)
Positives and negatives of using MAE
MAE is a popular metric to use for evaluating regression models, but there are also some disadvantages you should be aware of when deciding whether to use it or not.
Positives of using MAE
- Understandable for end users
- Value is given in terms of the target you are predicting
- Simple to calculate in Python
Negatives of using MAE
- Unless converting to MAPE, it is not comparable across datasets
What is a good MAE score?
The closer MAE is to 0, the more accurate the model is. But MAE is returned on the same scale as the target you are predicting for and therefore there isn’t a general rule for what a good score is. How good your score is can only be evaluated within your dataset.
MAE can, however, be developed further by calculating the MAPE (Mean Absolute Percentage Error), which is the MAE returned as a percentage. This can make it easier to interpret your error value.
Can you compare MAE scores from different models?
MAE cannot be compared across different models and datasets. However, by converting MAE to MAPE (Mean Absolute Percentage Error), it becomes possible to compare model performance as this error is returned as a percentage.
Is a higher or lower MAE better?
The lower the MAE score the better. This is because MAE is a measure of the average error between the predictions and intended targets, thus we want to minimise this value.
What is the ideal value of MAE?
There is no ideal value for MAE as it is returned on the same scale that you are predicting, so an ideal MAE value for one dataset will not be the same for another.
What is a high MAE?
There is no high value for MAE, as MAE is returned on the same scale that you are predicting. For example, a high value when predicting basket size in a grocery store will be extremely low for a model which is predicting house prices.
Join the newsletter to receive the latest updates from the world of Data Science in your inbox.