蟒蛇学习。为什么我只在第一次收到警告?

Don*_*beo 3 python lasso-regression scikit-learn

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

>>> 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) 
>>> 
Run Code Online (Sandbox Code Playgroud)

Der*_*ren 5

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

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

import warnings
warnings.simplefilter("always")
Run Code Online (Sandbox Code Playgroud)