Skip to content

Instantly share code, notes, and snippets.

@securetorobert
Created July 12, 2018 00:47
Show Gist options
  • Save securetorobert/d8fa6ff57ccafad6236f1a8b5459a254 to your computer and use it in GitHub Desktop.
Save securetorobert/d8fa6ff57ccafad6236f1a8b5459a254 to your computer and use it in GitHub Desktop.
Linear Regression Model for Boston housing data
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