I'm doing a linear regression:
lr = LinearRegression(fit_intercept=True)
lr.fit(X_train, y_train)
print("R2 OLS: " str(lr.score(X_train, y_train)))
It is easy to get the predicted values for testing:
lr.predict(X_test)
and then I can further use those values. But is there any way to get the predicted values (y) by the OLS during training?
CodePudding user response:
You can predict on the X_train:
lr.predit(X_train)
For example, this is where the regression line is: