Skip to content

Instantly share code, notes, and snippets.

@aniruddha27
Created March 12, 2020 07:39
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 aniruddha27/5c88215717d4eefdc75d9f4a49c0ba3a to your computer and use it in GitHub Desktop.
Save aniruddha27/5c88215717d4eefdc75d9f4a49c0ba3a to your computer and use it in GitHub Desktop.
#import ridge model
from sklearn.linear_model import Ridge
#fit on training data with regularization of 0.3
ridge = Ridge(alpha = 0.3)
ridge.fit(X_train,y_train)
#accuracy
print('Train',ridge.score(X_train,y_train))
print('Test',ridge.score(X_test,y_test))
#RMSE score
pred = ridge.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