Python sklearn。为什么我第一次收到警告?

时间:2013-11-28 11:47:15

标签: python scikit-learn lasso

我第一次收到警告。 这是正常的吗?

>>> cv=LassoCV(cv=10).fit(x,y)
C:\Python27\lib\site-packages\scikit_learn-0.14.1-py2.7-win32.egg\sklearn\linear_model\coordinate_descent.py:418: UserWarning: Objective did not converge. You might want to increase the number of iterations
  ' to increase the number of iterations')
>>> cv=LassoCV(cv=10).fit(x,y) 
>>> 

2 个答案:

答案 0 :(得分:4)

因为“目标没有收敛”。默认情况下,最大迭代次数为1000,您没有设置它们。尝试将max_iter参数设置为更高的值以避免警告。

答案 1 :(得分:4)

这是因为python警告过滤器设置为在默认情况下第一次捕获特定警告时发出警告。

如果您想获得所有警告,只需添加:

import warnings
warnings.simplefilter("always")