Created
March 16, 2020 11:16
-
-
Save aniruddha27/196ca409e9f722f6a826553afceb5288 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
from sklearn.linear_model import Ridge | |
from sklearn.metrics import mean_squared_error | |
# different alpha values | |
alphas = [0.01, 0.1, 0.3, 1, 3, 5, 10, 15, 20] | |
for a in alphas: | |
lr = Ridge(alpha=a) | |
lr.fit(X_train,y_train) | |
rmse = np.sqrt(mean_squared_error(y_test,lr.predict(X_test))) | |
print('For Alpha = ',a,', RMSE = ',rmse) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment