我试图用以下方法使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没有帮助.