analyticalmindsltd / smote_variants

A collection of 85 minority oversampling techniques (SMOTE) for imbalanced learning with multi-class oversampling and model selection features
http://smote-variants.readthedocs.io
MIT License
631 stars 137 forks source link

OversamplingClassifier does not work with probability-based metrics #77

Open oleg-kachan opened 1 year ago

oleg-kachan commented 1 year ago

I use custom scorer from sklearn, via make_scorer function. It does not work if needs_proba=True, so metrics like ROC AUC, PR AUC are unfeasible to be used with smote_variants.

The error says OversamplingClassifier does not have _classes field, had been the latest version pushed to pip?

gykovacs commented 1 year ago

Thank you for raising, I look into it.

oleg-kachan commented 1 year ago

I have a version 0.7.1 installed via pip and I don't see several lines which are present in the main branch of the github repo. So, maybe you need to update pypi by the latest version of the code?

The lines are in the following file https://github.com/analyticalmindsltd/smote_variants/blob/master/smote_variants/classifiers/_oversamplingclassifier.py

line 30, OversamplingClassifier._init_(): self.classes_ = None

line 47, OversamplingClassifier.fit(): self.classes_ = self.classifier_obj.classes_

gykovacs commented 1 year ago

Yes, this is the issue. I have prepared the release of 0.7.2, but one of the dependencies (metric-learn) struggles with the latest version of numpy. As soon as they fix it (already done, but not released yet), I will release 0.7.2 to PyPI, until that, you should be able to use it from the repo here.