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
623 stars 138 forks source link

DEAGO : negative values for categorical features inside the data #34

Open eponraj27392 opened 4 years ago

eponraj27392 commented 4 years ago

hello, I am working with a dataset which contains both categorical & continuous features. On implementing DEAGO, it output -ve values for categorical features after sampling ?? Could someone let me know, whether DEAGO doen't support cat_features in the dataset ??

gykovacs commented 4 years ago

Hi, only a handful of oversampling techniques considers categorical variables, and even so, it is not implemented in the smote-variants package. Most of the oversampling techniques operate in the Euclidean space, treating all attributes continuous. A commonly followed way to use oversampling techniques with categorical variables is encoding the categorical variables, for exampleyusing one-hot encoding. Then, oversamoling techniques might end up in feature values which are fractional numbers, but from the regression point of view it is not a problem as it just expresses that the samole might be somewhere between the two categories.

Alternatively, omce the one-hot encoding is done and the oversampling is applied, you might convert the oversampled fractional values to crisp binary ones to keep the categorical nature.

eponraj27392 commented 4 years ago

Since I found SMOTENC from imbalanced learn library which can take cat_feature index as input, I thought this libraray too have some attributes to mention about the cat_features.

gykovacs commented 4 years ago

SMOTENC is just a hack to apply SMOTE to categorical data. If you encode your categorical features by one-hot encoding and standardize the continuous features to have the standard deviation 1, vanilla SMOTE and all other smote variants (including DEAGO) will operate in the same metric space as SMOTENC. So there is no need for special arguments to pass categorical features, you just need to encode them properly.