Scikit-学习抛出警告,增加Lasso的迭代次数

时间:2018-03-18 23:32:22

标签: python scikit-learn linear-regression lasso

我正在尝试使用Python的Linear Regression包与LASSO一起运行Scikit-learn

对于Lasso,我的配置如下:

lasso_eps = 0.0001
lasso_alpha = 20
lasso_iter = 5000

该模型的代码如下:

lasso_cv = LassoCV(eps=lasso_eps, n_alphas=lasso_alpha, max_iter=lasso_iter, normalize=True, cv=5)
model = make_pipeline(PolynomialFeatures(degree=2, interaction_only=False), lasso_cv)
model.fit(X_train, y_train.values.ravel())

y_predict = model.predict(X_test)
model_score = model.score(X_test, y_test)
print(f"Accuracy: {model_score}")

虽然,我正在得到我的模特得分;我也收到了以下警告:

/Users/pankajkumar/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/coordinate_descent.py:491: 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)

有人可以建议,这个警告意味着什么以及如何解决? 任何帮助将不胜感激。

0 个答案:

没有答案