Topic · Mechanisms

Class imbalance

Everything on this site about class imbalance, in the order to read it: a page is listed after the pages it builds on. The figures below are the ones those pages use to explain it; each is live: move a slider and it recomputes.

In reading order

  1. Project

The figures these pages use

Pulled from the pages above. Move a slider and the figure recomputes, exactly as on its page.

From Understanding Focal Loss —A Quick Read › Focal Loss

0.8
From p to p_t. Whatever the label, p_t is 'how right the model was'. A large p_t is an easy example.

From Understanding Focal Loss —A Quick Read › Focal Loss

0.25
α-balanced cross-entropy. α scales the foreground curve and 1 − α the background curve. It changes how much each class counts, not which examples are hard.

From Understanding Focal Loss —A Quick Read › Focal Loss

2.0
The modulating factor (1 − p_t)^γ. γ = 0 is plain cross-entropy. As γ grows, everything to the right of p_t ≈ 0.5 is pushed towards zero.

From Understanding Focal Loss —A Quick Read › Focal Loss

4.00.25
Focal loss for y = 1 and y = 0. Left: a foreground example. Right: a background example. A larger γ flattens the side where the model is already right.

From Understanding Focal Loss —A Quick Read › Focal Loss

0.5
Cross-entropy for y = 1 and y = 0. Left: a foreground example. Right: a background example. Even a confident, correct prediction still carries some loss.

From Understanding Focal Loss —A Quick Read › Focal Loss

2.00.25
Focal loss and cross-entropy. Loss for a positive example as the model grows confident. The dashed line is cross-entropy.

Tags that go with it

Domain adaptation 1Loss functions 1Object detection 1Semi-supervised learning 1