Imbalanced-learn: A Python Toolbox to Tackle the Curse of Imbalanced Datasets in Machine Learning
Guillaume LemaitreFernando NogueiraChristos K. Aridas
Presents imbalanced-learn, a Python library integrated with scikit-learn that provides standardized implementations of over-sampling, under-sampling, and ensemble algorithms to effectively train machine learning models on skewed class distributions.
Real-world datasets in fields such as fraud detection, medical diagnosis, and bioinformatics often contain far fewer examples of one class than others. This imbalance disrupts standard machine learning algorithms that assume roughly equal class sizes or costs, leading to poor performance on the minority class. The problem ranks among the top ten challenges in data mining and pattern recognition.
The article set out to introduce and describe an open-source Python toolbox that supplies a range of established methods for correcting class imbalance. The toolbox aims to fill a gap in the Python ecosystem by offering tools that integrate directly with widely used libraries.
The authors built the imbalanced-learn package around four categories of techniques: under-sampling, over-sampling, combined sampling, and ensemble approaches. Development followed scikit-learn conventions, relied solely on numpy, scipy, and scikit-learn, and incorporated unit tests achieving 99 percent coverage, continuous integration, and community review processes. At the time of writing, the repository attracted roughly 2,000 visits and 300 unique visitors each week.
The toolbox supplies fixed and cleaning under-sampling routines, random and SMOTE-based over-sampling with several variants, combinations that pair SMOTE with cleaning steps, and two ensemble methods that reuse majority-class samples across multiple balanced subsets. All samplers expose a consistent fit, sample, and fit-sample interface, and a Pipeline class allows seamless chaining with scikit-learn transformers and estimators.
These capabilities give practitioners a single, maintained Python resource for balancing data before model training, reducing the need to switch languages or implement methods from scratch. Integration with scikit-learn lowers adoption barriers and supports reproducible workflows in production environments.
The authors plan to add further prototype-selection and generation methods along with additional user guides. Users should monitor the GitHub repository for these extensions and test the current release on their own datasets before large-scale deployment.
The description focuses on implementation and design rather than new empirical benchmarks, so performance gains will vary by data set and downstream classifier. Readers should verify results on representative samples and consider the MIT license and scikit-learn-contrib status when evaluating long-term maintenance.
- Paper: SMOTE: Synthetic Minority Over-sampling Technique, N. Chawla et al. (2002). This seminal paper introduces SMOTE, the foundational synthetic oversampling algorithm implemented and extended throughout the imbalanced-learn toolbox.
- Paper: Scikit-learn: Machine Learning in Python, Fabian Pedregosa et al. (2011). It outlines the core design, API conventions, and pipelining standards that imbalanced-learn strictly adopts to ensure seamless compatibility within the Python ecosystem.
- Paper: Addressing the Curse of Imbalanced Training Sets: One-Sided Selection, M. Kubát et al. (1997). This foundational work introduces One-Sided Selection and Tomek-link cleaning concepts that serve as primary under-sampling routines implemented in the toolbox.
- Paper: The foundations of cost-sensitive learning, Charles Elkan (2001). This work establishes the theoretical foundation linking class rebalancing to cost-sensitive decision-making and optimal classification thresholds.
- Paper: The relationship between Precision-Recall and ROC curves, Jesse Davis et al. (2006). It provides essential evaluation theory demonstrating why standard ROC analysis can be misleading under heavy class skew and why precision-recall dynamics must be considered.
- Paper: SMOTE for Learning from Imbalanced Data: Progress and Challenges, Marking the 15-year Anniversary, Alberto Fernández et al. (2018). This comprehensive 15-year retrospective systematically evaluates dozens of SMOTE variants and modern challenges, extending the survey of techniques implemented in the imbalanced-learn package.
- Paper: Class-Balanced Loss Based on Effective Number of Samples, Yin Cui et al. (2019). This work advances beyond traditional heuristic resampling techniques by formulating a loss-reweighting framework based on the theoretical effective number of samples.
- Paper: Learning Imbalanced Datasets with Label-Distribution-Aware Margin Loss, Kaidi Cao et al. (2019). It extends imbalanced learning to deep neural networks through margin loss adjustments and deferred re-balancing schedules that address the shortcomings of classical resampling.
- Paper: A systematic study of the class imbalance problem in convolutional neural networks, Mateusz Buda et al. (2017). This empirical study evaluates how classical resampling remedies—like those packaged in imbalanced-learn—perform when applied directly to modern convolutional neural network architectures.
