model.score and r2_score giving different values for a regression model I am build a linear regression model and a decision tree model using sklearn. I want to compare the performance of these two models, I have calculated the r2_score for both the models. I have calculated the model.score for both the values. I am confused which is a better metric to compare the performance of these models. Also what does model.score gives?

from sklearn.metrics import r2_score
score_DT = r2_score(y_pred_DT,y_test)

dt_score = regressorDT.score(X_test,y_test)
Both functions are the same r2 metric and should produce the same results.

Your usage of the r2_score function is wrong. The first argument should be the ground truth values and not the predicted values, so in your case it should be:

score_DT = r2_score(y_test, y_pred_DT)