liveBook · Manning

Class imbalance

As explained in Inside Deep Learning: Math, Algorithms, Models

A dataset condition in which some classes occur much more frequently than others.

Class imbalance occurs when classes appear in uneven proportions. A model can then favor the majority label, producing high accuracy while failing to detect the minority class. section 4.2.1

Why accuracy can mislead

For cancer prediction, a dataset with 99.9% “no cancer” cases permits 99.9% accuracy by always predicting “no cancer,” yet the model is not useful. In a 99% A and 1% B dataset, random splitting might produce 99.5% A and 0.5% B. section 4.2.1

Stratified sampling preserves the original class ratios in train/test splits. It provides a simple improvement for the name-language dataset, while broader imbalance treatments remain outside scope. section 4.2.1

How Inside Deep Learning: Math, Algorithms, Models covers it

How deep it goes
Defines uneven class ratios, explains majority-label bias, and stops short of broader imbalance methods.
Examples
Uses cancer prediction, 99:1 class ratios, and a name-language classification dataset as concrete examples.
What it assumes
Assumes classification labels and train/test splitting; teaches majority-class risk through an intuitive example.
What you can do after
Apply it via scikit-learn stratified sampling when creating train/test splits.
How it connects
Connects class imbalance to stratified sampling, random sampling, train/test splits, and model evaluation.

Also explained in

Compare how 11 books explain class imbalance →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Inside Deep Learning: Math, Algorithms, Models. The section links point to the parts of the book it draws on.