Learning Imbalanced Datasets with Label-Distribution-Aware Margin Loss

Kaidi Cao, Colin Wei, Adrien Gaidon, Nikos Arechiga, Tengyu Ma · NeurIPS 2019 · 2019

In one paragraph

For a class with n_j training points and margin \gamma_j, a margin generalization bound for the class-conditional error behaves like \frac{1}{\gamma_j\sqrt{n_j}} (up to terms shared by all classes). Choosing margins to minimise the sum of these bounds, subject to a budget \sum_j\gamma_j=\beta, is a one-line Lagrange problem: set \partial/\partial\gamma_j\,[c_j/\gamma_j]=-c_j/\gamma_j^2=-\lambda with c_j=n_j^{-1/2}, so \gamma_j\propto\sqrt{c_j}=n_j^{-1/4}. The LDAM loss implements this by subtracting a class-dependent offset \Delta_j=C/n_j^{1/4} from the true-class logit inside the softmax.

DRW (deferred re-weighting): train with plain (or LDAM) loss first, so the features are learned on the natural distribution, then switch on class-balanced weights near the end of the schedule.

Checked

With counts 5000/500/50 the optimum is \gamma^*=(0.168,\,0.299,\,0.532) for a unit budget; no one of 200k random feasible allocations beats its cost (0.4991). The minority/majority margin ratio is (5000/50)^{1/4}=3.16 (checks.py).

Questions and doubts

Takeaways