-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Home
Welcome to the UnbalancedDataset wiki!
UnbalancedDataset is a python module offering a number of resampling techniques commonly used in datasets showing strong between-class imbalance.
Most classification algorithms will only perform optimally when the number of samples of each class is roughly the same. Highly skewed datasets, where the minority heavily outnumbered by one or more classes, haven proven to be a challenge while at the same time becoming more and more common.
One way of addresing this issue is by resampling the dataset as to offset this imbalance with the hope of arriving and a more robust and fair decision boundary than you would otherwise.
Resampling techniques are divided in two categories: 1. Under-sampling the majority class(es). 2. Over-sampling the minority class.
Bellow is a list of the methods currently implemented in this module.
-
Under-sampling
- Random majority under-sampling with replacement
- Extraction of majority-minority Tomek links
- Under-sampling with Cluster Centroids
-
Over-sampling
- Random minority over-sampling with replacement
- SMOTE - Synthetic Minority Over-sampling Technique
- bSMOTE(1&2) - Borderline SMOTE of types 1 and 2
- SVM_SMOTE - Support Vectors SMOTE
All objects in this module transform a data set D = (X, y) of a (numpy) array of features and a (numpy) arry of labels into a new, resampled dataset D' = (X', y'). There are three methods to do so.
Methods:
- fit : Find the target statistics to determine the minority class, and the number of samples in each class. Takes (X, y) as parameters.
- transform : Returns the re sampled version of the original data set (X, y) passed to fit.
- fit_transform : Automatically performs both fit and transform. Takes (X, y) as parameters.
Example:
Dependencies.
- Numpy
- Scikit-Learn
This is a work in progress. Any comments, suggestions or corrections are welcome.
References:
SMOTE - "SMOTE: synthetic minority over-sampling technique" by Chawla, N.V et al.
Borderline SMOTE - "Borderline-SMOTE: A New Over-Sampling Method in Imbalanced Data Sets Learning, Hui Han, Wen-Yuan Wang, Bing-Huan Mao"
SVM_SMOTE - "Borderline Over-sampling for Imbalanced Data Classification, Nguyen, Cooper, Kamei"