IMBENS: Ensemble Class-imbalanced Learning in Python

Zhining Liu, Zhepei Wei, Erxin Yu, Qiang Huang, Kai Guo, Boyang Yu, Zhaonian Cai, Hangting Ye, Wei Cao, Jiang Bian, Pengfei Wei, Jing Jiang, Yi ChangarXiv 2021

TL;DR

This paper introduces imbens, an open-source Python toolbox that simplifies and enhances ensemble learning for class-imbalanced datasets. It provides standardized implementations of popular methods, along with flexible features like custom schedulers and detailed logging, making it easier for researchers and practitioners to tackle real-world imbalanced learning challenges.

What Problem Does This Paper Address?

Many real-world machine learning applications, such as fraud detection or medical diagnosis, suffer from class imbalance. This means that one or more classes are significantly underrepresented in the training data. Standard machine learning algorithms, optimized for overall accuracy, tend to perform poorly on imbalanced datasets because they can simply ignore the minority class and still achieve high accuracy. Imbalanced learning (IL) aims to address this by developing methods that learn unbiased models from imbalanced data. While resampling and reweighting are common IL techniques, ensemble imbalanced learning (EIL) combines multiple IL methods to further improve performance and reduce variance. However, a lack of readily available, well-documented, and flexible implementations of these EIL methods in existing Python packages hinders their widespread adoption and development.

Methods

The core contribution of this paper is the imbens Python package. It offers:

  • Standardized Implementations: imbens provides implementations for 14 popular Ensemble Imbalanced Learning (EIL) methods. These methods are categorized based on their approach:
  • Resampling-based: These methods modify the data distribution by undersampling the majority class or oversampling the minority class.
  • Reweighting-based: These methods adjust the importance of samples or classes during training, often through cost-sensitive learning.
  • Ensemble Manners: The package supports both iterative (e.g., boosting) and parallel (e.g., bagging) ensemble strategies.
  • Extended Functionalities: Beyond basic implementations, imbens introduces:
  • Customizable Resampling Scheduler: Allows users to dynamically adjust sampling strategies during the training process.
  • Verbose Logging: Provides detailed information about the training and evaluation of EIL models, aiding in debugging and understanding.
  • Scikit-learn Inspired API: The package follows a familiar and well-documented API design, similar to scikit-learn, making it easy for users to integrate and use.
  • Modular Design: The implementation decouples imbalance handling from ensemble training, allowing for easier extension and the creation of new EIL algorithms by leveraging inheritance.

Datasets

The paper does not explicitly list specific benchmark datasets used for evaluating imbens. However, it mentions that the imbens.datasets module can generate synthetic imbalanced data using parameters like n_samples and weights (e.g., weights=[.9,.1]). The authors also state that the toolbox is designed to be used with real-world imbalanced datasets commonly encountered in applications like click-through rate prediction, medical diagnosis, and fraud detection.

Key Insights and Ideas

  • Bridging the Implementation Gap: A significant contribution is providing readily accessible Python implementations for EIL methods that were previously lacking standard implementations in popular libraries.
  • Flexibility is Key: The inclusion of features like customizable resampling schedulers and detailed logging empowers users to fine-tune their EIL strategies and gain deeper insights into model behavior.
  • Ease of Use and Extensibility: The scikit-learn-like API and modular design lower the barrier to entry for using EIL methods and encourage the development of new algorithms.
  • Benchmarking Made Easier: The ImbalancedEnsembleVisualizer utility simplifies the process of evaluating and comparing different EIL models across various datasets and metrics.

Key Results

The paper focuses on presenting the imbens toolbox rather than reporting empirical results on specific datasets. However, it highlights:

  • Comprehensive Coverage: imbens implements 14 popular EIL methods.
  • High Code Quality: The project adheres to PEP8 standards and boasts 96% unit test coverage for release 0.2.0.
  • Active Development and Adoption: At the time of writing, the GitHub repository had over 180 stars and PyPI downloads exceeded 1,000 per month, indicating growing interest and usage.
  • Demonstrated Utility: Code snippets and figures showcase the ease of use for training, evaluating, and visualizing EIL models using the imbens API.

Limitations and Future Work

  • Limited Method Set (Currently): While 14 methods are implemented, the authors acknowledge that only a handful of EIL methods are available in existing packages.
  • Future Work: The authors plan to:
  • Include additional EIL methods, particularly those based on evolutionary algorithms, meta-learning, or hybrid-sampling techniques.
  • Provide more detailed examples, user guides, and tutorials to further support users and developers.

Summary updated

BibTeX
@misc{liu2021imbens,
  author = {Zhining Liu and Zhepei Wei and Erxin Yu and Qiang Huang and Kai Guo and Boyang Yu and Zhaonian Cai and Hangting Ye and Wei Cao and Jiang Bian and Pengfei Wei and Jing Jiang and Yi Chang},
  title = {{IMBENS: Ensemble Class-imbalanced Learning in Python}},
  year = {2021},
  eprint = {2111.12776},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2111.12776},
}
Figure