imbalanced-learn
Toolbox for imbalanced dataset in machine learning
What it is and what it does
imbalanced-learn is a scikit-learn-compatible Python toolbox for handling datasets where one class significantly outnumbers others—a common problem in real-world machine learning. It implements multiple re-sampling strategies (both oversampling and undersampling) to balance class distributions before training, helping classification algorithms learn more robust decision boundaries on skewed data.
The package integrates seamlessly into scikit-learn workflows via a standard transformer interface, making it straightforward to include resampling in preprocessing pipelines. It depends on numpy, scipy, scikit-learn, joblib, and threadpoolctl, and supports Python 3.10 through 3.14. The project is actively maintained as part of the scikit-learn-contrib ecosystem.
Use it for:
- Preprocess fraud detection datasets where fraudulent transactions are rare before training a classifier
- Balance medical diagnosis datasets with few positive cases to improve model sensitivity
- Prepare imbalanced text classification data for training with rare event prediction
- Create balanced training sets in credit risk or loan default prediction tasks
- Handle class imbalance in anomaly detection or rare failure prediction scenarios
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides re-sampling techniques to address class imbalance in machine learning datasets, integrating with scikit-learn for preprocessing imbalanced data before model training.
Yes. Active maintenance, low install friction, permissive MIT license, and no known vulnerabilities make this a safe choice. It solves a real, common problem in machine learning with a mature, well-integrated API. Install if you work with imbalanced classification datasets.
Install
imbalanced-learn on PyPI
pip
pip install imbalanced-learnuv
uv add imbalanced-learnpoetry
poetry add imbalanced-learnInstalling imbalanced-learn
Before you install
Low friction installation with a pure-Python wheel. Active maintenance with recent releases; last commit 2026-06-29. Depends on well-established scientific Python stack (numpy, scipy, scikit-learn, joblib).
License in practice
MIT license (permissive) allows use in commercial and private projects with minimal restrictions.
Quickstart
pip install imbalanced-learn
import imbalanced_learn
from sklearn.datasets import make_classification
X, y = make_classification()
# Use imbalanced-learn resampling techniques in preprocessing pipeline
Verify before relying
- Whether optional dependencies (Pandas, TensorFlow, Keras) are required for core functionality or only for specific features
- Performance characteristics when handling very large datasets
- Specific resampling algorithms included and their names
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — numpy, scipy, scikit-learn, sklearn-compat, joblib, threadpoolctl |
| Maintenance | actively maintained — 68 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 16,822,922/month — #1,138 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: imbalanced_learn-0.14.2-py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
imbalance-xgboostWraps XGBoost with weighted and focal loss…
permissive · top 15,000 on PyPI
imblearnThis package is a deprecated stub that…
unclear · top 5,000 on PyPI
scikit-learn-extraExtends scikit-learn with additional machine…
permissive · top 15,000 on PyPI
scikit-surpriseScikit-surprise builds and evaluates…
permissive · top 15,000 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
bootstrappedBuilds confidence intervals from data samples…
unclear · top 15,000 on PyPI
sklearn-compatProvides backward-compatible wrappers for…
permissive · top 5,000 on PyPI
forestciComputes confidence intervals and variance…
permissive · top 15,000 on PyPI
spark-sklearnDistributes scikit-learn model training and…
permissive · top 15,000 on PyPI
riverRiver provides online machine learning…
permissive · top 15,000 on PyPI