from sklearn.linear_model import Lasso # TODO explain options param_grid = {'alpha': np.logspace(-5, 0, 10)} grid = GridSearchCV(Lasso(max_iter=10000, normalize=True), param_grid, cv=10) grid.fit(X_train, y_train) print(grid.best_score_) print(grid.best_params_)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter