add R2 evaluation for linear_regression

it will help to know the regression presicison
This commit is contained in:
Jack Huang
2018-08-21 14:26:39 +08:00
committed by GitHub
parent 957fcc6853
commit 8ca35c677f

View File

@ -29,3 +29,6 @@ regressor.fit(X_train, Y_train)
# Predicting the Test set results
y_pred = regressor.predict(X_test)
# regression evaluation
from sklearn.metrics import r2_score
print(r2_score(Y_test,y_pred))