GridSearchCV套索警告收敛警告:目标未收敛

时间:2018-11-27 15:31:26

标签: python scikit-learn

我正在尝试使用CVGridSearch为我的数据找到最佳参数

lasso = Lasso(random_state=0)
alphas = [0.5, 0.1 , 0.01 ]
max_iter = [1000, 2000, 3000]
tuned_parameters = [{'alpha': alphas , 'max_iter' : max_iter}]
n_folds = 5
clf = GridSearchCV(lasso, tuned_parameters, cv=n_folds, refit=False)
clf.fit(X_train, y_train.values.ravel())

运行代码时,它会显示以下警告信息

Best: 0.999998 using {'alpha': 0.1, 'max_iter': 1000}
Best: -2028.743734 using {'alpha': 0.1, 'max_iter': 1000}
/usr/local/lib/python3.6/site- 
packages/sklearn/linear_model/coordinate_descent.py:492: 
ConvergenceWarning: Objective did not converge. You might want to 
increase the number of iterations. Fitting data with very small alpha 
may cause precision problems.
ConvergenceWarning)
Best: -2241.410408 using {'alpha': 0.01, 'max_iter': 1000}
/usr/local/lib/python3.6/site- 
packages/sklearn/linear_model/coordinate_descent.py:492: 
ConvergenceWarning: Objective did not converge. You might want to 
increase the number of iterations. Fitting data with very small alpha 
 may cause precision problems.

找到最高分数0.999998时,为什么CVGridsearch不停止?

0 个答案:

没有答案