There are a number of ways to measure the performance of a model, fitting the data. Once the model has been formulated and its parameters estimated, the next big step is measuring how good or bad it performs on the validation set.

The idea is to predict some quantities of which the true value is known and measure how far or, if the analyst did it right, how close the predicted value is to the true one.

The literature offers several ways to measure that quantity. In this post I want to focus on two widely used quantities: the Mean Squared Error (MSE) and the Mean Absolute Error (MAE).

If is the predicted quantity and is the true value of the variable we are estimating,

$ MSE=\frac{1}{n} \sum_{i=1}^{n} (f_i – y_i)^2 $

and

$ MAE = \frac{1}{n} \sum_{i=1}^{n} |f_i -y_i| $

MAE is clearly a linear score that averages the magnitude of the error with the same weight across all $n$. It is more indicated to measure the accuracy of continuous variables.

In contrast, MSE measures the residuals by assigning a larger “weight” to those differences that are more consistent across the $n$. The square of a very small quantity (smaller than 1) is even smaller, therefore it would contribute to the overall MSE in a much smaller amount. The thickness of the bars in the graph should clarify this.

MAE vs MSE

Which measure should one use? As an old professor of mine was used to answer: *it depends*.

For a continuous variable, for which we would measure a “relaxed” and average estimation error, I would use MAE.

For those cases in which the main contribution to the overall error should depend only on more consistent differences between true and predicted values, I would go for MSE, which seems to be stricter than its alternative.

(oo)

*Related*

Pingback: Quora