Issue
I am building a multiple linear regression model using the following:
regressor = sm.OLS(y_train, X_train).fit()
When requesting a summary of the model with regressor.summary()
, the R-squared is 0.204. However, when using r2_score(y_test, y_pred)
I get 0.023.
What am I missing here?
Solution
regressor.summary()
is giving r2 for training data
while r2_score(y_test, y_pred)
is giving r2 for testing data
Answered By - datawiz
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.