git404hub

what is imbalanced-learn fr?

scikit-learn-contrib/imbalanced-learn — explained in plain English

Analysis updated 2026-06-22

7,102PythonAudience · dataComplexity · 2/5Setup · easy

tl;dr

A Python library that fixes skewed training datasets by generating synthetic minority-class examples or trimming the majority class, so your classifier stops ignoring the rare category you actually care about.

vibe map

mindmap
  root((imbalanced-learn))
    What it does
      Fixes skewed datasets
      Oversampling minority
      Undersampling majority
    Tech Stack
      Python
      scikit-learn
      NumPy SciPy
    Use Cases
      Fraud detection
      Medical classification
      Pipeline integration
    Audience
      Data scientists
      ML engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Train a fraud detection model that can actually spot fraud, not just predict every transaction as legitimate.

VIBE 2

Fix a medical dataset where disease cases are far outnumbered by healthy ones before fitting any classifier.

VIBE 3

Drop a resampling step directly into a scikit-learn pipeline so your cross-validation folds are handled correctly.

VIBE 4

Combine oversampling and undersampling together to find the best balance for your specific dataset.

what's the stack?

Pythonscikit-learnNumPySciPypandasTensorFlowKeras

how it stacks up fr

scikit-learn-contrib/imbalanced-learntraceloop/openllmetryranaroussi/quantstats
Stars7,1027,1007,105
LanguagePythonPythonPython
Setup difficultyeasymoderateeasy
Complexity2/52/52/5
Audiencedatadeveloperdata

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · easy time til it works · 30min

pip install imbalanced-learn, requires Python 3.10+ and a compatible scikit-learn version.

in plain english

imbalanced-learn is a Python library that helps with a specific problem in machine learning: when the dataset you are training on has far more examples of one category than another. For instance, a fraud detection model might have thousands of legitimate transactions for every single fraudulent one. Most standard classification algorithms are not designed for this kind of skewed data, and they tend to learn to predict the majority category almost exclusively while ignoring the rare one. The library addresses this by providing resampling techniques. These methods adjust the training data before you fit a model, either by generating synthetic examples of the minority category (oversampling), removing some examples from the majority category (undersampling), or combining both approaches. The result is a dataset with a more balanced distribution that typical classifiers can learn from more effectively. The package is built to work directly with scikit-learn, the most widely used Python machine learning library. imbalanced-learn follows the same API conventions, so the resampling objects fit into existing scikit-learn pipelines without major changes to your workflow. It is part of the official scikit-learn-contrib collection of compatible extensions. Installation is available through pip or conda. It requires Python 3.10 or newer and depends on NumPy, SciPy, and scikit-learn. Optional dependencies include pandas for dataframe support and TensorFlow or Keras if you are working with those model types. Full documentation and usage examples are hosted at the project's documentation site. The library was originally published in the Journal of Machine Learning Research in 2017.

prompts (copy fr)

prompt 1
I'm training a fraud detection model in scikit-learn and my dataset has 1% fraud cases. How do I use imbalanced-learn SMOTE to oversample the minority class before fitting?
prompt 2
How do I add an imbalanced-learn resampler as a step inside a scikit-learn Pipeline so it runs during cross-validation?
prompt 3
My binary classifier ignores the rare class entirely. Which imbalanced-learn technique should I try first, oversampling, undersampling, or a combination, and why?
prompt 4
Show me how to use RandomUnderSampler from imbalanced-learn to reduce the majority class and then evaluate the model with a confusion matrix.
prompt 5
How do I install imbalanced-learn and check it works with my existing scikit-learn version?

Frequently asked questions

what is imbalanced-learn fr?

A Python library that fixes skewed training datasets by generating synthetic minority-class examples or trimming the majority class, so your classifier stops ignoring the rare category you actually care about.

What language is imbalanced-learn written in?

Mainly Python. The stack also includes Python, scikit-learn, NumPy.

How hard is imbalanced-learn to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is imbalanced-learn for?

Mainly data.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.