When your dataset is just a majority-class fan club
imbalanced-learn gives scikit-learn users re-sampling tools to offset heavily skewed class distributions, because most classifiers quietly assume every category arrived in roughly equal numbers.

What it does
imbalanced-learn is a Python package that provides re-sampling techniques for datasets where one or more classes heavily outnumber the rest. It plugs into scikit-learn pipelines, letting you rebalance data as a preprocessing step without leaving the familiar estimator API. The aim is to keep the decision boundary from collapsing into a simple majority-class vote.
The interesting bit
The project lives in the scikit-learn-contrib ecosystem, so it follows scikit-learn’s design patterns rather than inventing its own. That composability is the quiet win: you can slot an over-sampler or under-sampler into a Pipeline like any other transformer. The README also frames the problem in terms of fairness and robustness—admitting that a model biased toward the majority class often ignores the minority entirely.
Key highlights
- Re-sampling methods for strong between-class imbalance, compatible with scikit-learn workflows.
- Endorses SPEC 0 for dependency lifecycle management.
- Optional support for Pandas DataFrames, TensorFlow, and Keras models.
- Published in the Journal of Machine Learning Research in 2017.
- Requires Python ≥3.10 and scikit-learn ≥1.4.2.
Verdict
Grab it if you are building fraud detectors, failure predictors, or any classifier where the interesting event is rare. If your classes are already balanced, you can skip it.
Frequently asked
- What is scikit-learn-contrib/imbalanced-learn?
- imbalanced-learn gives scikit-learn users re-sampling tools to offset heavily skewed class distributions, because most classifiers quietly assume every category arrived in roughly equal numbers.
- Is imbalanced-learn open source?
- Yes — scikit-learn-contrib/imbalanced-learn is open source, released under the MIT license.
- What language is imbalanced-learn written in?
- scikit-learn-contrib/imbalanced-learn is primarily written in Python.
- How popular is imbalanced-learn?
- scikit-learn-contrib/imbalanced-learn has 7.1k stars on GitHub.
- Where can I find imbalanced-learn?
- scikit-learn-contrib/imbalanced-learn is on GitHub at https://github.com/scikit-learn-contrib/imbalanced-learn.