2013-11-28 51 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") 
相關問題