Question

I have code that estimates RMSE for k-fold cross-validation and I think it is correct (from book: Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, 2nd Edition by Aurélien Géron)

scores = cross_val_score(forest_reg, a, b, scoring="neg_mean_squared_error", cv=10)
print(pd.Series(np.sqrt(-scores)).describe())



So what about MAE? Should I use (with sqrt):

scores = cross_val_score(forest_reg, a, b, scoring="neg_mean_absolute_error", cv=10)
print(pd.Series(np.sqrt(-scores)).describe())

or this (without sqrt):

scores = cross_val_score(forest_reg, a, b, scoring="neg_mean_absolute_error", cv=10)
print(pd.Series(-scores).describe())

Also for MAE estimation, it should be -scores or scores?

Was it helpful?

Solution

It’s an issue of units.

Compare what you’re doing in RMSE and in MAE.

RMSE is a way of getting MSE back to the original units, like how we take the square root of variance to get standard deviation. This makes more physical sense. Sure, we can make sense of square meters, but what about square dollars?

When you do MAE, you don’t have that squaring action to give you squared units. Consequently, while MSE in in square units, MAE is in the original units.

You could take the square root of MAE, but then you’d wind up with measurements with units of $\sqrt{\$}$ or the square root of whatever units you’re using. The result is that your measure of dispersion is not in the original units, which a probably what you want.

I do not see any use for taking the square root of MAE. If you do, please do share. That would be very interesting.

Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange
scroll top