Sharp error bounds for imbalanced classification: how many examples in the minority class?

Anass Aghbalou, Anne Sabourin, François Portier

Abstract

In imbalanced classification, reweighting the loss function is a standard technique used to balance true positive and true negative rates. However, theoretical understanding has lagged behind practice, particularly in scenarios where the minority class is extremely rare relative to the total sample size. This paper addresses this gap by analyzing the setting where the rare class probability $p$ approaches zero. We provide two primary contributions: a non-asymptotic fast rate probability bound for constrained balanced empirical risk minimization (ERM) and a consistent upper bound for balanced nearest neighbors estimates. Our results demonstrate that the effective sample size for learning is governed by the number of minority examples ($np$), rather than the total dataset size ($n$).

Introduction

In domains such as fraud detection, medical diagnosis, and anomaly detection, the class of interest is often significantly underrepresented. Standard Empirical Risk Minimization (ERM) typically fails in these contexts because it optimizes for global accuracy; a model can achieve 99.9% accuracy by simply ignoring a minority class that represents 0.1% of the data. While practitioners frequently employ cost-sensitive learning—weighting the loss function to penalize errors on the minority class more heavily—the mathematical foundations for these methods have largely assumed that the minority class probability $p$ remains a fixed constant.

In reality, as datasets grow, the minority class often becomes relatively rarer ($p \to 0$). This research investigates the "learning frontier" of imbalanced classification, specifically asking: how many minority examples are required to achieve statistical consistency and high accuracy?

Theoretical Framework: Balanced Risk

The authors focus on Balanced Risk, a metric that assigns equal weight to the error rates of both the majority and minority classes. This ensures that the model's performance on the rare class is given the same importance as the frequent class. The study evaluates two distinct algorithmic approaches:

  1. Constrained Balanced ERM: A framework for classifiers (such as logistic regression) where the empirical risk is weighted to compensate for class imbalance.
  2. Balanced $k$-Nearest Neighbors ($k$-NN): A non-parametric method where the classification threshold is adjusted based on the estimated minority class probability $\hat{p}$.

To derive tight (or "sharp") error bounds, the researchers utilized advanced statistical tools, including Bernstein-type concentration inequalities and local Rademacher complexities. These methods allow for a more granular analysis of the model's behavior near the optimal decision boundary, facilitating the derivation of "fast rates" of convergence.

Key Insights: The $1/np$ Scaling

The most significant theoretical finding is that the error rate in imbalanced settings scales with $1/np$ (for fast rates) or $1/\sqrt{np}$ (for standard rates). This confirms that the bottleneck for learning is not the total number of observations ($n$), but specifically the expected number of minority class examples ($np$).

Fast Rates and the Bernstein Condition

Previously, it was unclear whether imbalanced classification could achieve fast convergence rates (where error decreases at a rate of $1/n$ rather than $1/\sqrt{n}$). This paper proves that under a "Bernstein condition"—which relates the variance of the loss function to its expectation—fast rates of $1/np$ are indeed achievable. This represents a mathematical refinement over previous bounds by a factor of $\sqrt{p}$, which is substantial when $p$ is very small.

The $k$-NN Learning Frontier

For the Balanced $k$-NN rule, the authors established that consistency requires more than just a large $k$. Specifically, the product of the number of neighbors and the minority probability must tend toward infinity ($kp \to \infty$). Intuitively, a "neighborhood" must be large enough to contain a sufficient representation of the minority class to make an informed decision.

Empirical Validation

The theoretical bounds were tested using both synthetic and real-world data:

  • Synthetic Experiments: Using multivariate-student distributions, the authors controlled the degree of imbalance ($p = n^{-a}$) to observe the transition from learnability to failure. The results showed that the excess risk followed the predicted $1/np$ curve with high precision.
  • Real-World Benchmarks: The models were evaluated on six datasets from the ODDS (Outlier Detection DataSets) repository, including Pima (diabetes), Breast (cancer), and Satellite data. These experiments confirmed that the balanced ERM approach maintains robustness even under severe relative rarity.

Limitations and Future Directions

While this work provides a rigorous foundation for balanced risk, several areas remain for future exploration:

  • Metric Expansion: The current bounds are specific to Balanced Risk. Extending this framework to other common imbalanced metrics, such as the F1-measure or Precision-Recall AUC, is a necessary next step.
  • Estimation of $p$: There is a subtle theoretical gap when the true minority probability $p$ is unknown and must be replaced by its estimate $\hat{p}$. While the results hold empirically, a full theoretical reconciliation remains an open question.
  • High-Dimensionality: The study assumes a fixed or slowly growing feature dimension. Investigating the behavior of these bounds when the number of features $d$ exceeds the number of minority examples $np$ would provide further insights into modern high-dimensional data challenges.

Conclusion

By proving that the effective sample size for imbalanced learning is $np$, this paper provides a clearer roadmap for practitioners. It establishes that fast convergence is possible even in the face of extreme imbalance, provided the loss function is correctly rescaled and the minority class count grows sufficiently with the total sample size.

Summary updated

BibTeX
@inproceedings{aghbalou2024sharp,
  author = {Anass Aghbalou and Anne Sabourin and François Portier},
  title = {{Sharp error bounds for imbalanced classification: how many examples in the minority class?}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2024},
  url = {https://openreview.net/forum?id=QiAskRUrti},
}
Figure