小编Eun*_*Lee的帖子

python warnings.filterwarnings不会忽略'import sklearn.ensemble'中的DeprecationWarning

我试图用以下方法使DeprecationWarning保持沉默.

import warnings
warnings.filterwarnings(action='ignore')
from sklearn.ensemble import RandomForestRegressor
Run Code Online (Sandbox Code Playgroud)

但是,它仍然显示:

DeprecationWarning:numpy.core.umath_tests是一个内部NumPy模块,不应导入.它将在未来的NumPy版本中删除.来自numpy.core.umath_tests导入inner1d

为什么会发生这种情况,我该如何解决?

我在python 3.6.6,numpy 1.15.0和scikit-learn 0.19.2上运行它,并且添加category=DeprecationWarning没有帮助.

python suppress-warnings scikit-learn deprecation-warning

5
推荐指数
1
解决办法
876
查看次数