Source-linked AI summary
Imbalanced-learn: A Python Toolbox to Tackle the Curse of Imbalanced Datasets in Machine Learning
Guillaume Lemaitre, Fernando Nogueira, Christos K. Aridas
TL;DR
Class imbalance arises when a class has relatively few samples, compromising standard machine-learning algorithms that expect balanced distributions or equal misclassification costs. The paper presents imbalanced-learn, a Python toolbox for processing such datasets, with scikit-learn-inspired sampler interfaces and extensive quality assurance.
Problem
Class imbalance makes learning concepts from under-represented classes difficult and substantially compromises standard machine-learning algorithms.
Method
The paper presents the imbalanced-learn API, a Python toolbox whose sampler classes use methods inspired by the scikit-learn API.
Results
The toolbox provides a Python-based approach for processing imbalanced datasets, addressing the lack of such a toolbox identified by the authors.
Takeaways & Limitations
Imbalanced-learn provides a dedicated Python toolbox for tackling imbalanced datasets, supported by unit tests, continuous integration, and collaborative development practices.
Abstract
from arXiv · showhide
Imbalanced-learn is an open-source python toolbox aiming at providing a wide range of methods to cope with the problem of imbalanced dataset frequently encountered in machine learning and pattern recognition. The implemented state-of-the-art methods can be categorized into 4 groups: (i) under-sampling, (ii) over-sampling, (iii) combination of over- and under-sampling, and (iv) ensemble learning methods. The proposed toolbox only depends on numpy, scipy, and scikit-learn and is distributed under MIT license. Furthermore, it is fully compatible with scikit-learn and is part of the scikit-learn-contrib supported project. Documentation, unit tests as well as integration tests are provided to ease usage and contribution. The toolbox is publicly available in GitHub: https://github.com/scikit-learn-contrib/imbalanced-learn.
1. Introduction
Real-world datasets often under-represent some classes, creating a class-imbalance problem that can compromise standard machine-learning methods. Imbalanced-learn addresses the lack of a comparable Python toolbox by presenting an API for handling imbalanced datasets.
- Class imbalance occurs when one class has substantially fewer samples than others, making learning that class difficult.
- The problem affects domains including telecommunications, bioinformatics, fraud detection, and medical diagnosis.
- Imbalanced data can compromise learning because standard algorithms often expect balanced classes or equal misclassification costs.
- Before this work, specialized approaches were implemented mainly in R, while no comparable Python toolbox was available to the authors.
- The paper presents imbalanced-learn, a Python toolbox designed to tackle imbalanced datasets in machine learning.
2. Project management
The project emphasizes software quality, compatibility, collaborative development, and documentation to support both users and contributors.
- Unit tests provide 99% coverage for toolbox release 0.1.8, while PEP8 and automated checks support code consistency.
- Travis CI integrates new code and helps ensure back-compatibility for users and developers.
- Git, GitHub, and gitter support collaborative programming, issue tracking, code integration, and idea discussion.
- Consistent API documentation is provided to support toolbox use and contribution.
3. Implementation design
The implementation follows scikit-learn conventions for samplers and pipelines while relying on numpy, scipy, and scikit-learn. A SMOTE example demonstrates the API workflow.
- The SMOTE code example generates an imbalanced dataset, constructs an SMOTE sampler, and applies it to X and y.
- The implementation relies on numpy, scipy, and scikit-learn and follows the scikit-learn API for sampler classes.
- Sampler classes use fit to compute parameters needed for resampling into a balanced dataset.
- The sample method performs sampling and returns data with the desired balancing ratio.
- The fit_sample method combines fitting and sampling in one call.
- A scikit-learn Pipeline combines samplers, transformers, and estimators automatically.
4. Implemented methods
Imbalanced-learn organizes its methods into under-sampling, over-sampling, combined sampling, and ensemble learning. These methods adjust class distributions through reduction, generation, cleaning, or balanced-set ensembles.
- The toolbox provides four strategies: under-sampling, over-sampling, combined over- and under-sampling, and ensemble learning.
- Notation and background: The balancing ratio is the minority-class sample count divided by the majority-class sample count.
- Notation and background: Balancing resamples an imbalanced dataset into a new dataset with a higher balancing ratio.
- Under-sampling: Under-sampling reduces majority-class samples and includes fixed methods and cleaning methods.
- Under-sampling: Fixed under-sampling targets a specified ratio using random selection, clustering, nearest-neighbor rules, or classification accuracy.
- Under-sampling: Cleaning under-sampling instead removes samples according to empirical nearest-neighbor criteria without targeting a specific ratio.
- Over-sampling: Over-sampling generates minority-class samples, using random replication or SMOTE interpolation between nearest minority-class neighbors.
- Combined sampling: SMOTE may overfit, motivating combinations with cleaning methods such as Tomek links or edited nearest neighbours.
5. Future plans and conclusion
The paper presents the foundations of the imbalanced-learn toolbox vision and API, and identifies planned extensions for methods and documentation.
- The paper presents the foundations of the imbalanced-learn toolbox vision and API.
- Future work will add methods based on prototype/instance selection, generation, and reduction.
- Additional user guides are also planned for the imbalanced-learn API.
A Python Toolbox to Tackle the Curse of Imbalanced Datasets in Machine Learning
This section cites prior work on imbalanced learning, data mining, sampling, classification, and machine-learning toolboxes. The references include both methodological studies and software resources.
- The references include work on addressing the curse of imbalanced training sets and data mining with imbalanced class distributions.
- Several cited studies investigate undersampling, nearest-neighbor methods, selection, and balancing difficult or small classes.
- The bibliography includes research on over-sampling for imbalanced data and on data complexity.
- Scikit-learn and SHOGUN are cited as machine-learning toolboxes implemented in Python or provided as general machine-learning software.
- Additional references cover edited data, nearest-neighbor rules, challenging data-mining problems, and learning with R.