I am using GridSearchCV to tune hyperparameters of regression decision tree. When I do, I get mean_test_score but I thought it would return mean MSE since it is a regressor. how to interpret mean_test_score? Is there a way to tweak GridSearchCV so it returns mean MSE?

here is my code

tree_reg = GridSearchCV(DecisionTreeRegressor(criterion="mse"), {
}, cv=5, return_train_score=False)

tree_reg.fit(X, y)

>>> params                   split0_test_score  .... mean_test_score
   {"min_samples_leaf":2,        0.998782             0.9989933

   {"min_samples_leaf":2,        0.998823             0.998930

what does mean_test_score mean?


By default, GridSearchCV uses the score method of its estimator; see the last paragraph of the scoring parameter on the docs:

If None, the estimator’s score method is used.

And DecisionTreeRegressor.score (indeed, all/most regressors) uses R^2.

In response to your edit: you can specify scoring='neg_mean_squared_error'. But note too that there's a linear relationship between MSE and R^2, so optimizing either of these are equivalent.


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.