Mean absolute error
Mean absolute error, or MAE, is a regression evaluation metric that measures the average magnitude of errors between predicted and actual values, regardles...
The Average Size of Your Prediction Mistakes
Mean absolute error, or MAE, is a regression evaluation metric that measures the average magnitude of errors between predicted and actual values, regardless of direction. It is computed by taking the absolute difference between each prediction and its true value, summing those absolute differences, and dividing by the number of examples. The result is expressed in the same units as the target variable, making it directly interpretable.
The main advantage of MAE is robustness to outliers. Because each error is weighted linearly, a single large misprediction does not inflate the metric dramatically. This makes MAE the preferred choice when the dataset contains anomalies or when occasional large errors are expected and should not dominate the evaluation.
Comparing MAE to mean squared error clarifies its behavior. MSE squares each error before averaging, which penalizes large errors quadratically. A model making one very large error and many small errors would show a much higher MSE than MAE relative to a model making uniformly moderate errors. Depending on the business context, you might prefer MSE if large errors are particularly costly, or MAE if all errors are roughly equally bad regardless of size.
MAE is convex as a function of model parameters, meaning gradient-based optimization can minimize it without risk of local minima for linear models. However, it is not differentiable at zero error, which can complicate some gradient-based optimizers. A smooth approximation called Huber loss combines MAE and MSE behavior, using MAE for large errors and MSE for small errors.
A concrete example: a model predicts daily electricity demand in megawatt-hours. Actual values are 200, 220, and 180; predictions are 195, 230, and 185. The absolute errors are 5, 10, and 5. The MAE is 20 divided by 3, approximately 6.67 megawatt-hours, a straightforward measure of typical prediction error.
Exam tip: state clearly that MAE is interpretable in the units of the target variable and is preferred over MSE when robustness to outliers matters more than heavily penalizing large mistakes.