Xgbregressor Score Method Returning Strange Values
I've tried to use XGBRegressor's score method from the Python API and It's returning a result of 0.917. I am expecting this to be the r2 score of the regression. However, trying r2
Solution 1:
When you call xgbr.score()
this code is actually called:
...
return r2_score(y, self.predict(X), sample_weight=None,
multioutput='variance_weighted')
But when you are calling the r2_score explicitly, the default value of multiouput
param is "uniform_average".
Try the below code:
r2_score(y_pred, y_test, multioutput='variance_weighted')
And you will get identical results.
Post a Comment for "Xgbregressor Score Method Returning Strange Values"