menu

忽略sklearn警告提示

出现如下警告

lib/python3.6/site-packages/sklearn/semi_supervised/_label_propagation.py:288: ConvergenceWarning: max_iter=30 was reached without convergence.
  category=ConvergenceWarning


为了控制Python警告,您可以使用警告库。请参阅此处的详细文档。因此,可以按以下方式使用warning.simplefilter()方法:

from  warnings import simplefilter
from sklearn.exceptions import ConvergenceWarning
simplefilter("ignore", category=ConvergenceWarning)

更多可以看这里 https://stackoverflow.com/questions/53784971/how-to-disable-convergencewarning-using-sklearn

编辑