Skip to content

Instantly share code, notes, and snippets.

@lakshay-arora
Created January 28, 2020 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lakshay-arora/5abb21036bef23da9379e95ffb08c6bc to your computer and use it in GitHub Desktop.
Save lakshay-arora/5abb21036bef23da9379e95ffb08c6bc to your computer and use it in GitHub Desktop.
# create an object of the LinearRegression Model
model_LR = LinearRegression()
# fit the model with the training data
model_LR.fit(train_x, train_y)
# predict the target on train and test data
predict_train = model_LR.predict(train_x)
predict_test = model_LR.predict(test_x)
# Root Mean Squared Error on train and test date
print('RMSE on train data: ', mean_squared_error(train_y, predict_train)**(0.5))
print('RMSE on test data: ', mean_squared_error(test_y, predict_test)**(0.5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment