smote_variants icon indicating copy to clipboard operation
smote_variants copied to clipboard

OversamplingClassifier does not work with probability-based metrics

Open oleg-kachan opened this issue 1 year ago • 3 comments

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?

oleg-kachan avatar Sep 12 '23 07:09 oleg-kachan

Thank you for raising, I look into it.

gykovacs avatar Sep 24 '23 19:09 gykovacs

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_

oleg-kachan avatar Sep 26 '23 22:09 oleg-kachan

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.

gykovacs avatar Oct 02 '23 18:10 gykovacs