Reputation: 95
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
Upvotes: 9
Views: 10782
Reputation: 155
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:
from sklearn.utils import all_estimators
Upvotes: 0
Reputation: 1561
In version 0.21.3: sklearn.utils.testing
from sklearn.utils.testing import ignore_warnings
In version 0.24.1 or later (link): sklearn.utils._testing
(with underscore)
from sklearn.utils._testing import ignore_warnings
Upvotes: 8
Reputation: 525
For those who are facing 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)
Upvotes: 1
Reputation: 423
As mentioned by @ywbaek, the following import fixes this problem for Scikit-learn version: 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)
Upvotes: -2