AI/ML ยท Minor tasks

Class Imbalance

When one class is rare, a model can look accurate while being useless.

What is class imbalance?

One class has far more examples than the other.

What is class imbalance?

Scatter plot: thousands of class-0 points, a small cluster of class-1 points
Bar chart: fraud is 0.2% of the data, not fraud is 99.8%
Scatter plot: a few positive stars among many negative points

The accuracy trap

0.2%fraud
99.8%not fraud

A "model" that always answers not fraud:

accuracy 99.8%

Frauds it catches:

0%