← Back to Leaderboard
Iscikit-learn-contrib

scikit-learn-contrib/imbalanced-learn

Scikit-learn-compatible Python toolkit for resampling imbalanced training data

AI Framework
Engineering Health (Methodology)
B+ · 69/100
Maintenance Activity
● Updated 5mo ago
Latest Release
0.14.2
Commercial License Check
MIT · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance12/35
Fork Adoption23/25
Release Cadence14/20
License Clarity20/20
API
Total Stars
★ 7,139
24h Growth
+1
7d Growth
+1
Forks
1,393

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

scikit-learn-contrib/imbalanced-learn Star History (2020-01-12 - 2026-12-04) ALL-TIME STAR HISTORY (2020-01 – 2026-12) +3.3k in 2518d · avg +1/day 7.3k 5.4k 3.4k 2020-01-12: ★ 3,8582020-06-13: ★ 4,2272020-11-14: ★ 4,5932021-04-17: ★ 4,9562021-09-18: ★ 5,2522022-02-19: ★ 5,5142022-07-23: ★ 5,7732022-12-24: ★ 6,0142023-05-27: ★ 6,2022023-10-28: ★ 6,3972024-03-30: ★ 6,5522024-08-31: ★ 6,6902025-02-01: ★ 6,8212025-07-05: ★ 6,9382025-12-06: ★ 7,0122026-05-09: ★ 7,0622026-12-04: ★ 7,139 ★ 7.1k 2020-01 2023-06 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

imbalanced-learn is an in-process Python library for the training and evaluation stages of scikit-learn classification workflows. Its implementation lives under imblearn/, alongside examples/ and doc/. The integration boundary is a Python API: a sampler produces a revised training dataset, and the downstream estimator fits on it. At prediction time, use the fitted model without resampling incoming data.

NumPy and SciPy provide the scientific computing dependencies, while scikit-learn supplies the estimator and model-selection ecosystem. The architecture is compositional: the sampler, estimator, and cross-validation splitter are separate choices. This lets teams test a sampling change without changing the classifier, but it also makes the order of preprocessing, resampling, and fitting an explicit part of the experiment design.

Key Capabilities & Differentiators

The library changes the class representation seen during fitting. Oversampling increases minority-class representation; undersampling reduces the number of retained examples from selected classes. SMOTENC is a specific oversampling option for data with both continuous and categorical features. Its presence should not be read as blanket support for arbitrary feature encodings or sampler inputs.

Version 0.14.0 added InstanceHardnessCV, which allocates samples to folds based on how difficult they are to classify. That addresses a different problem from resampling: it controls how difficult cases are distributed during model comparison, while the sampler changes the fitting data within each training fold. Neither a hardness-aware split nor balanced training data, by itself, demonstrates better performance at the real class prevalence.

Trade-offs & Limitations

An estimator's built-in class weights are a useful first baseline where available: they leave the dataset unchanged and avoid a separate sampling step. imbalanced-learn is worth testing when weighting is unavailable or when changing the examples seen during fitting is part of the experiment. Oversampling can increase fit time and memory use; undersampling can discard informative majority-class examples.

The most consequential integration error is resampling before splitting. Keep each sampler inside the training fold and evaluate on untouched data at the original prevalence. If the application relies on probabilities or fixed decision thresholds, check calibration and threshold performance on untouched data as well: changing the class balance during training does not change how often positive cases occur in production.

Hardware & Deployment Guide

Install imbalanced-learn in the Python environment used for training or evaluation. Documented minimum versions are Python 3.10, NumPy 1.25.2, SciPy 1.11.4, and scikit-learn 1.4.2; the dependency list also includes pytest 7.2.2 or newer. The build uses setuptools and setuptools_scm. This is local library execution, with no hosted API, database, or CUDA service required for core resampling.

The 0.14.1 and 0.14.2 releases address scikit-learn 1.8 and 1.9 compatibility, respectively. Pin and test the two libraries together, especially before upgrading an established training environment. For sizing, measure a representative fold with the intended sampler, estimator, and parallelism: the number of rows produced by the sampler affects both memory use and downstream fit cost.

Integration: The imblearn Python package complements scikit-learn classifiers at training time; it is not a network inference API.
Sampling: Resampling changes the examples presented to the estimator, rather than only changing how it weights errors.
Mixed feature types: SMOTENC is an oversampling option for datasets with both categorical and continuous features.
Cross-validation: InstanceHardnessCV, added in 0.14.0, distributes samples across folds based on estimated classification difficulty.
Compatibility: Releases 0.14.1 and 0.14.2 address scikit-learn 1.8 and 1.9 compatibility, respectively.
Packaging: pyproject.toml uses setuptools and setuptools_scm; the project is MIT-licensed.
Best For

Teams training scikit-learn classifiers for rare events, such as manufacturing defects, that need to compare resampling with class weighting under controlled validation.

Skip If

You need LLM inference or a standalone prediction service, or class weighting already meets your false-positive and missed-event targets without adding a sampling stage.

Reviewed on 2026-12-04 · Grounded in GitHub README, root file tree & releasesMethodology

Comparison vs. Top LLMs & Inference Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
imbalanced-learn ★7.1k+1PythonMITScikit-learn-compatible Python toolkit for resampling imbalanced training data
scikit-learn68.5k+126PythonBSD-3-ClauseIn-process Python library for machine learning and data mining
keras64.5k+24PythonApache-2.0Multi-backend Python SDK for building, training, and running deep learning model
pytorch-lightning31.5k+31PythonApache-2.0PyTorch training with a managed Trainer and Fabric for custom distributed loops

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/scikit-learn-contrib/imbalanced-learn.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

scikit-learn-contrib/imbalanced-learn Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about imbalanced-learn

Where should resampling happen during cross-validation?

Resample only the training portion of each fold, fit the classifier on the resulting data, and score it on the untouched validation portion. Resampling the full dataset before splitting can leak information across folds and distort the class distribution used for evaluation.

Do I need a GPU, and how should I size a training job?

The core scientific Python stack does not require CUDA or a GPU. Size the job around peak RAM and the cost of the sampler and estimator together. Oversampling can increase the size of the training set, and running folds in parallel can multiply peak memory usage. Profile a representative fold before increasing parallelism.

Can we use it commercially and run it in our own environment?

Yes. The MIT license permits commercial use, modification, and redistribution. Preserve the copyright and license notices when distributing copies or substantial portions. The library can run in your own Python environment without a hosted service; review dependency licenses and data-handling obligations separately.

When is resampling preferable to scikit-learn class weights?

Start with class weighting if your estimator supports it: it changes how the estimator treats mistakes without adding or removing rows. Evaluate resampling when that baseline falls short or the estimator lacks class weights. Compare both on the same untouched validation splits using metrics that reflect the cost of missed positives and false alarms.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining scikit-learn-contrib/imbalanced-learn? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature scikit-learn-contrib/imbalanced-learn on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare