2013-11-28 52 views
3

我仅在第一时间收到警告。 这是正常的吗?Python sklearn。为什么我第一次收到警告?

>>> 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) 
>>> 
+0

我觉得是啊..这是正常的。 – aIKid

回答

4

因为“客观没有收敛”。最大迭代次数默认为1000,您不设置它们。尝试将max_iter参数设置为较高的值以避免警告。

+0

好的谢谢,但我只是想知道为什么我只收到一次警告。 – Donbeo

+0

也许它收敛其他迭代,但不是一个! –

3

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

如果你想获得所有的警告,只是补充一点:

import warnings 
warnings.simplefilter("always") 
相关问题