Created
March 12, 2020 07:36
-
-
Save aniruddha27/59bdc710a9065cfaf4a2ed99a575110e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import linear regression | |
from sklearn.linear_model import LinearRegression | |
#fit on training data | |
lr=LinearRegression() | |
lr.fit(X_train,y_train) | |
#accuracy | |
print('Training accuracy =',lr.score(X_train,y_train)) | |
print('Testing accuracy =',lr.score(X_test,y_test)) | |
#RMSE score | |
pred = lr.predict(X_test) | |
rmse = np.sqrt(mean_squared_error(y_test,pred)) | |
print('RMSE =',rmse) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment