[英]ModuleNotFoundError: No Module named 'sklearn.utils._testing'
from sklearn.utils._testing import ignore_warnings
ModuleNotFoundError: No Module named 'sklearn.utils._testing'
How Could I solve this problem?我该如何解决这个问题? My sklearn version is 0.21.3
我的 sklearn 版本是 0.21.3
Those who are facing ModuleNotFoundError: No module named 'sklearn.utils.testing'那些面临 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)
For those facing the following error ModuleNotFoundError: No module named 'sklearn.utils.testing', an alternative solution to that of @desertnaut would be to load from the root rather than from testing:对于那些面临以下错误 ModuleNotFoundError: No module named 'sklearn.utils.testing' 的人,@desertnaut 的替代解决方案是从根加载而不是从测试加载:
from sklearn.utils import all_estimators从 sklearn.utils 导入 all_estimators
As mentioned by @ywbaek, the following import fixes this problem for Scikit-learn version: 0.21.3 :正如@ywbaek 所述,以下导入解决了Scikit-learn 版本的此问题: 0.21.3 :
from sklearn.utils.testing import ignore_warnings
sklearn.utils._testing
may be introduced in a later version (as observed from SK Github Repo ) sklearn.utils._testing
可能会在以后的版本中引入(从SK Github Repo观察到)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.