Posts Mean Absolute Error (MAE) - Evaluation Metrics
Post
Cancel

Mean Absolute Error (MAE) - Evaluation Metrics

Brief

Mean absolute error is one of the evaluation metrics used in measuring the accuracy of a model. As its name says it calculates an error with an absolute figure which means a positive number. Let’s see the formula and understand it.

Formula

\begin{equation} \mathrm{MAE}= \frac{1}{\mathrm{n}} \sum_{\mathrm{j}=1}^{\mathrm{n}} \left| \mathrm{y}_{\mathrm{j}}-\mathrm{\hat y} _ {\mathrm{j}}\right| \end{equation}

Explanation

Here, \( \sum \) = symbol for doing addition of values,
n = number of records,
j = record index starting from 1 (first record),
y = actual record from our testing data,
\( \mathrm{\hat y} \) = predicted value of y record from a model,
| | = pipes for converting floating point value to absolute value

So, this formula will calculate the sum of absolute differences between the actual value y and predicted value \( \mathrm{\hat y} \) (yhat) for all records and divide them by n the number of records.

Example

Let’s look at one example for better understanding:

Actual ValuePredicted ValueDifference
10.312.5-2.2
25.722.13.6
15.811.24.6

if we calculate the summation of absolute differences, it would be like:
\( 2.2 + 3.6 + 4.6 = 10.4\)

10.4 is our sum of absolute differences. Remember -2.2 will become 2.2 when we take an absolute value. | | (pipes) in our formula are meant for that.
Now, we will divide 10.4 by 3 which is the number of records in this case:

\( 10.4 / 3 = 3.67\)

3.67 is our MAE (Mean Absolute Error).
That’s it! You are done with the MAE (Mean Absolute Error).

This post is licensed under CC BY 4.0 by the author.