Data Science & ML
Basic

Mean Absolute Error (MAE)

Average of absolute differences between predictions and actual values.

Formula

MAE=1n∑i=1n∣yi−y^i∣MAE = \frac{1}{n}\sum_{i=1}^{n}|y_i - \hat{y}_i|

Variables

y_iActual
\hat{y}_iPredicted
nSamples

Example

For errors 2, -1, 3: MAE = (2+1+3)/3 = 2

How it works

Mean Absolute Error measures how far predictions are from the true values, on average, after turning each error into a positive amount. Taking the absolute value prevents positive and negative mistakes from canceling each other out, so it reflects the typical size of the miss. Dividing by the number of samples gives a single summary number that is easy to compare across models or datasets.

When to use it

Use MAE when you want an easy-to-interpret measure of average prediction error in the same units as the target, such as dollars, degrees, or units sold. It is especially useful when large errors should count, but you do not want them to dominate the metric as strongly as in squared-error measures.

Worked example, step by step

Suppose the actual values are 10, 14, and 18, and the predicted values are 12, 13, and 15. Step 1: Find each absolute error: |10 - 12| = 2, |14 - 13| = 1, |18 - 15| = 3. Step 2: Add the absolute errors: 2 + 1 + 3 = 6. Step 3: Divide by the number of samples: MAE = 6 / 3 = 2. Final answer: MAE = 2.

Common mistakes to avoid

  • Forgetting the absolute value and letting positive and negative errors cancel out
  • Averaging the raw errors instead of the absolute errors
  • Using the wrong number of samples in the denominator

Did You Know?

MAE is more robust to outliers than MSE.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026