scikit-learn-contrib / imbalanced-learn

A Python Package to Tackle the Curse of Imbalanced Datasets in Machine Learning
https://imbalanced-learn.org
MIT License
6.85k stars 1.29k forks source link

fix scikit-learn 1.5 parse_version link #1070

Closed celestinoxp closed 8 months ago

celestinoxp commented 8 months ago

https://github.com/scikit-learn-contrib/imbalanced-learn/blob/e78ff7acc2d0362604f2578fad8e4a318345dfbe/imblearn/base.py#L20

File [~\anaconda3\lib\site-packages\imblearn\base.py:20](http://localhost:8888/~/anaconda3/lib/site-packages/imblearn/base.py#line=19)
     17     from sklearn.base import _OneToOneFeatureMixin as OneToOneFeatureMixin
     19 from sklearn.preprocessing import label_binarize
---> 20 from sklearn.utils import parse_version
     21 from sklearn.utils.multiclass import check_classification_targets
     23 from .utils import check_sampling_strategy, check_target_type

ImportError: cannot import name 'parse_version' from 'sklearn.utils'

I think should be from sklearn.utils.fixes import parse_version

add ".fixes" after from sklearn.utils

celestinoxp commented 8 months ago

and here:

File [~\anaconda3\lib\site-packages\imblearn\_config.py:10](http://localhost:8888/~/anaconda3/lib/site-packages/imblearn/_config.py#line=9)
      7 from contextlib import contextmanager as contextmanager
      9 import sklearn
---> 10 from sklearn.utils import parse_version
     12 sklearn_version = parse_version(sklearn.__version__)
     14 if sklearn_version < parse_version("1.3"):

ImportError: cannot import name 'parse_version' from 'sklearn.utils'