Hey,
apparently upon calling from sklearn.impute import IterativeImputer an ImportError is thrown. I set up a fresh conda environment but the problem persists. Had to update /sklearn/impute/__init__.py and was just wondering if that was intended. According to the patch notes IterativeImputer should still be included.
conda create -n sklearn_test python=3.7
conda activate sklearn_test
pip install scikit-learn
python
from sklearn.impute import IterativeImputer
ImportError: cannot import name 'IterativeImputer' from 'sklearn.impute' (/Users/schidani/anaconda3/envs/sklearn_test/lib/python3.7/site-packages/sklearn/impute/__init__.py)
with /sklearn/impute/__init__.py content:
"""Transformers for missing value imputation"""
from ._base import MissingIndicator, SimpleImputer
from ._knn import KNNImputer
__all__ = [
'MissingIndicator',
'SimpleImputer',
'KNNImputer'
]
Adapted /sklearn/impute/__init__.py content:
"""Transformers for missing value imputation"""
from ._base import MissingIndicator, SimpleImputer
from ._knn import KNNImputer
from ._iterative import IterativeImputer
__all__ = [
'MissingIndicator',
'SimpleImputer',
'KNNImputer',
'IterativeImputer'
]
conda==4.8.1
python==3.7.7
sklearn==0.22.2.post1
Cheers,
dsethz
It is explicitly written in the documentation of sklearn.impute.IterativeImputer that you need to enable the import because this estimator is still experimental:
>>> # explicitly require this experimental feature
>>> from sklearn.experimental import enable_iterative_imputer # noqa
>>> # now you can import normally from sklearn.impute
>>> from sklearn.impute import IterativeImputer
Hope this answers your question :)
Most helpful comment
It is explicitly written in the documentation of sklearn.impute.IterativeImputer that you need to enable the import because this estimator is still experimental:
Hope this answers your question :)