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
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
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
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)
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
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)