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

sv.MulticlassOversampling error for getattr() function #75

Open azamkamranian opened 1 year ago

azamkamranian commented 1 year ago

I was checking the document's example of package. The following example gave me the error 'TypeError: getattr(): attribute name must be string'. Why?

import smote_variants as sv

Import sklearn.datasets as datasets 

dataset= datasets.load_wine() 

oversampler= sv.MulticlassOversampling(sv.distance_SMOTE) 

X_samp, y_samp= oversampler.sample(dataset['data'], dataset['target'])
gykovacs commented 1 year ago

Thank you for raising, I look into it.

gykovacs commented 1 year ago

Correct, there was a minor change in the interface recently and the docs have not been updated accordingly. Now I updated, it should be out with the next release (in a couple of days).

The correct use:

oversampler = sv.MulticlassOversampling(oversampler='distance_SMOTE', oversampler_params={})

You can specify any parametrization through the oversampler_params argument.