📅  最后修改于: 2022-03-11 14:58:06.299000             🧑  作者: Mango
lasso_params = {'alpha':[0.02, 0.024, 0.025, 0.026, 0.03]}
ridge_params = {'alpha':[200, 230, 250,265, 270, 275, 290, 300, 500]}
models2 = {'OLS': linear_model.LinearRegression(),
'Lasso': GridSearchCV(linear_model.Lasso(),
param_grid=lasso_params).fit(df[X], df[Y]).best_estimator_,
'Ridge': GridSearchCV(linear_model.Ridge(),
param_grid=ridge_params).fit(df[X], df[Y]).best_estimator_,}