from sklearn.utils._testing import ignore_warnings
ModuleNotFoundError: No Module named 'sklearn.utils._testing'
我该如何解决这个问题?我的sklearn版本是0.21.3
from sklearn.utils._testing import ignore_warnings
ModuleNotFoundError: No Module named 'sklearn.utils._testing'
我该如何解决这个问题?我的sklearn版本是0.21.3
sklearn.utils.testing
from sklearn.utils.testing import ignore_warnings
sklearn.utils._testing
。from sklearn.utils._testing import ignore_warnings
ModuleNotFoundError: No module named sklearn.utils.testing
的人,与@desertnaut的替代解决方案是从根目录而不是从测试中加载:from sklearn.utils import all_estimators
对于那些遇到了ModuleNotFoundError: No module named 'sklearn.utils.testing'
的人
import sklearn
estimators = sklearn.utils.all_estimators(type_filter=None)
for name, class_ in estimators:
if hasattr(class_, 'predict_proba'):
print(name)
正如 @ywbaek 所提到的,以下导入可以解决 Scikit-learn 版本:0.21.3 的问题:
from sklearn.utils.testing import ignore_warnings
sklearn.utils._testing
可能会在以后的版本中引入(从 SK Github Repo 观察到)
from sklearn.utils.testing import ignore_warnings
- ywbaek