-
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 class is heavily outnumbered by one or more classes, have proven to be a challenge while, at the same time, becoming more and more common.
One way of addressing 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
- NearMiss-(1 & 2 & 3)
- Condensend Nearest Neighbour
- One-Sided Selection
- Neighboorhood Cleaning Rule
- Edited Nearest Neighbours
- Instance Hardness Threshold
- Repeated Edited Nearest Neighbours
-
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
- ADASYN - Adaptive synthetic sampling approach for imbalanced learning
All objects in this module transform a data set D = (X, y) of a (numpy) array of features and a (numpy) array 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.
- sample : Returns the re sampled version of the original data set (X, y) passed to fit.
- fit_sample : 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"