Looking at sci-kit learn regression metrics, it gives us 5 metrics: explained variance score and $R^2$ score; mean absolute error, mean squared error and median absolute error.

The explained variance score and $R^2$ score are related and well explained on Wikipedia.

The same occurs for mean absolute error and mean squared error, two metrics commonly used (and well explained on this topic: while the mean absolute error considers all the data, but doesn't "weight" outliers, the mean squared error helps us to check for outliers.

But what does the median absolute error says about the data and the response of the models?


I have to disagree with the first posted answer. As stated in the documentation, the median absolute error is useful basically it is essentially insensitive to outliers (as long as there aren't too many of them). This is because it is the median of all of the absolute values of the residuals, and the median is unaffected by values at the tails. So, this loss function can be used to perform robust regression.

In contrast, the mean squared error can be highly sensitive to outliers, and mean absolute error can be somewhat sensitive to outliers (although less so than the mean squared error).

Note that using the median absolute error only corrects for outliers in the response/target variable, not for outliers in the predictors/feature variables.

One possible source of confusion is mean/median error vs. mean/median absolute error. The former cannot be used as a cost function for regression, since the cost must always be positive (among other things).

  • $\begingroup$ Thanks, @vbox ! This answer really makes sense for me, especially for the 3rd paragraph. $\endgroup$ – Minoru Dec 31 '16 at 14:54

With an OLS regression the mean error will be zero by construction. I guess you could use the median error to gauge the distribution around the mean - i.e. if you know the mean error is zero but the median error is -10 then you know there must be a few very large errors that skew the mean back up to zero.

It's not very informative really, I don't think. Many better error-based metrics like mean absolute percentage error, mean squared error, mean absolute error etc.

  • $\begingroup$ But, that way, you're considering the median error and I agree with you. The sci-kit learn metric is the median absolute error, which doesn't even gives you the information about the data format by comparing with the mean error. $\endgroup$ – Minoru Dec 30 '16 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.