SublimeREPL icon indicating copy to clipboard operation
SublimeREPL copied to clipboard

cannot import name '_ParamsValidationMixin' from 'imblearn.base'

Open beejay4l opened this issue 2 years ago • 2 comments

I've re-installed the latest scikit-learn and imbalanced-learn. I've also checked all other libraries to make sure they are compatible with imbalanced-learn. But I keep getting the error below when I try to import imblearn. Can somebody tell me why it's not working, please?

Code:

import imblearn from imblearn.over_sampling import SMOTE

Error Message:


ImportError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_15900/793248694.py in ----> 1 from imblearn.over_sampling import SMOTE

~\anaconda3\lib\site-packages\imblearn_init_.py in 35 import types 36 ---> 37 from . import combine 38 from . import ensemble 39 from . import exceptions

~\anaconda3\lib\site-packages\imblearn\combine_init_.py in 3 """ 4 ----> 5 from ._smote_enn import SMOTEENN 6 from ._smote_tomek import SMOTETomek 7

~\anaconda3\lib\site-packages\imblearn\combine_smote_enn.py in 9 10 from ..base import BaseSampler ---> 11 from ..over_sampling import SMOTE 12 from ..over_sampling.base import BaseOverSampler 13 from ..under_sampling import EditedNearestNeighbours

~\anaconda3\lib\site-packages\imblearn\over_sampling_init_.py in 6 from ._adasyn import ADASYN 7 from ._random_over_sampler import RandomOverSampler ----> 8 from ._smote import SMOTE 9 from ._smote import BorderlineSMOTE 10 from ._smote import KMeansSMOTE

~\anaconda3\lib\site-packages\imblearn\over_sampling_smote_init_.py in ----> 1 from .base import SMOTE, SMOTEN, SMOTENC 2 from .cluster import KMeansSMOTE 3 from .filter import SVMSMOTE, BorderlineSMOTE 4 5 all = [

~\anaconda3\lib\site-packages\imblearn\over_sampling_smote\base.py in 21 ) 22 ---> 23 from ...metrics.pairwise import ValueDifferenceMetric 24 from ...utils import Substitution, check_neighbors_object, check_target_type 25 from ...utils._docstring import _n_jobs_docstring, _random_state_docstring

~\anaconda3\lib\site-packages\imblearn\metrics\pairwise.py in 13 from sklearn.utils.validation import check_is_fitted 14 ---> 15 from ..base import _ParamsValidationMixin 16 from ..utils._param_validation import StrOptions 17

ImportError: cannot import name '_ParamsValidationMixin' from 'imblearn.base' (C:\Users\23480\anaconda3\lib\site-packages\imblearn\base.py)

beejay4l avatar Apr 25 '23 18:04 beejay4l

Hello Everyone,

I sincerely need your support to unravel the root cause of this error message. It is delaying my assessment work. Or if anyone can suggest any other method one can use to balance imbalance classes.

I will be awaiting your feedback.

Thank you all.

beejay4l avatar Apr 28 '23 08:04 beejay4l

Hi Everyone,

After uninstalling and re-installing Anaconda, my issue got resolved. I'm so happy right now.

beejay4l avatar Apr 29 '23 09:04 beejay4l