Created
March 12, 2020 07:41
-
-
Save aniruddha27/b289c4ded6ae98fa4c782e0912f7011b 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
#import lasso | |
from sklearn.linear_model import Lasso | |
#fit on training dataset | |
ls = Lasso(alpha=0.08) | |
ls.fit(X_train, y_train) | |
#accuracy | |
print('Training score =', ls.score(X_train, y_train)) | |
print('Testing score=', ls.score(X_test, y_test)) | |
#RMSE | |
pred = lasso.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