Created
July 12, 2018 00:47
-
-
Save securetorobert/d8fa6ff57ccafad6236f1a8b5459a254 to your computer and use it in GitHub Desktop.
Linear Regression Model for Boston housing data
This file contains hidden or 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
lr_model = LinearRegression() | |
lr_model.fit(X_train, y_train) | |
print('Training score: {}'.format(lr_model.score(X_train, y_train))) | |
print('Test score: {}'.format(lr_model.score(X_test, y_test))) | |
y_pred = lr_model.predict(X_test) | |
mse = mean_squared_error(y_test, y_pred) | |
rmse = math.sqrt(mse) | |
print('RMSE: {}'.format(rmse)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment