TL;DR
Standard $k$-nearest neighbor ($k$-NN) classifiers struggle with severely imbalanced data and suffer from computational bottlenecks at test time. This paper introduces under-bagging $k$-NN, an ensemble method that pairs random under-sampling with bootstrap aggregation to achieve minimax-optimal convergence rates under the Arithmetic Mean (AM) of recalls metric. Crucially, the method drastically shrinks the required neighborhood size $k$ and per-round sample size $s$, yielding dramatic speedups without sacrificing statistical accuracy.
What Problem Does This Paper Address?
In imbalanced classification, majority class instances vastly outnumber minority instances (sometimes by $10^6:1$). Standard classifiers optimize for overall zero-one classification loss, which inherently biases predictions toward the majority class: a model can achieve $99\%$ accuracy simply by ignoring minority examples entirely.
While the Arithmetic Mean (AM) of recalls (the unweighted mean of per-class recall rates) provides a fair, balanced evaluation, standard $k$-NN is statistically inconsistent with respect to the AM metric because the Bayes decision boundary shifts under balanced recall weighting. Furthermore, non-parametric $k$-NN requires searching all $n$ training instances, making inference painfully slow on massive datasets.
Methods
The authors propose under-bagging $k$-NN to resolve both statistical inconsistency and computational overhead:
- Class-Weighted Under-Sampling: In each bagging round $b \in \{1, \dots, B\}$, a subset $\mathcal{D}_b^u$ of expected size $s$ is drawn. Samples from class $m$ are accepted independently with probability $a(x, m) = s / (M n_{(m)})$, effectively equalizing class representations in expectation.
- Local Probability Estimation: A $k$-NN classifier is fitted on each sub-sample $\mathcal{D}_b^u$ to produce class posterior probability estimates $\hat{\eta}^{b,u}(x)$.
- Ensemble Aggregation: Predictions are averaged across all $B$ rounds ($\hat{\eta}^{B,u}(x) = \frac{1}{B}\sum_{b=1}^B \hat{\eta}^{b,u}(x)$), and the final label is assigned via $\arg\max_m \hat{\eta}^{B,u}_m(x)$.
- Theoretical Framework: Using empirical process theory, VC-dimension bounds, and Generalized Pascal distributions, the authors formulate a balanced surrogate loss to prove high-probability minimax optimal convergence rates under Hölder continuity ($\alpha$) and Tsybakov margin ($\beta$) conditions.
Datasets
- Synthetic Benchmark: A 2D two-interleaving "half-moons" dataset with Gaussian noise ($\sigma = 0.2$), evaluated at a $100:1$ class ratio ($20,000$ positive vs. $200$ negative instances).
- Real-World Benchmarks (UCI Repository): Nine diverse datasets spanning binary and multi-class tasks:
- APSFailure ($76{,}000$ rows, $170$ features, $1.81\%$ minority)
- ActivityRecognition ($22{,}646$ rows, $4$ classes, $1.48\%$ minority)
- Adult ($48{,}842$ rows, $105$ features)
- Bitcoin ($2{,}916{,}697$ rows, $6$ features, $1.42\%$ minority)
- BuzzInSocialMedia ($140{,}707$ rows, $77$ features)
- CensusIncomeKDD ($299{,}285$ rows, $503$ features)
- CreditCardClients ($30{,}000$ rows, $32$ features)
- OccupancyDetection ($20{,}560$ rows, $5$ features)
- p53Mutants ($31{,}420$ rows, $5{,}408$ features, $0.48\%$ minority)
Key Insights and Ideas
-
Optimal Convergence with Finite Bagging: Previous theoretical analyses assumed an infinite simulation ($B \to \infty$). Here, optimal convergence rates $\mathcal{O}((\log n / n)^{\frac{\alpha(\beta+1)}{2\alpha + d}})$ hold for a modest, finite number of rounds: $$B = \mathcal{O}\left((\rho n)^{\frac{2\alpha}{2\alpha+d}} (\log(\rho n))^{\frac{d}{2\alpha+d}}\right),$$ where $\rho$ is the imbalance ratio.
-
Shrinking the Neighborhood Size $k$: While standard $k$-NN requires $k \asymp n^{\frac{2\alpha}{2\alpha+d}}$, under-bagging reduces the required $k$ per round to $\mathcal{O}(\log(\rho n))$. When $d > 2\alpha$, bagging can even be applied to $1$-NN ($k=1$) while preserving minimax optimality!
- Dramatic Complexity Reductions:
- Tree construction: Reduced from $\mathcal{O}(nd \log n)$ to $\mathcal{O}((\rho n \log(\rho n))^{\frac{d}{2\alpha+d}} d)$ per base tree under parallel execution.
- Search phase (testing): Drops from $\mathcal{O}(n^{\frac{2\alpha}{2\alpha+d}} \log n)$ to $\mathcal{O}(\log^2(\rho n))$ per query.
Key Results
- Significant Speedups on Massive Datasets: On the Bitcoin dataset ($\sim 3$ million rows), under-bagging $k$-NN ($B=5, s=0.5Mn_{(1)}$) executed in $8.11$ seconds, compared to $16{,}885.49$ seconds ($\sim 4.7$ hours) for standard $k$-NN—a $99.95\%$ reduction in runtime.
- Superior Minority Detection (AM Score):
- On APSFailure, under-bagging ($B=5$) scored $94.64\%$ AM vs. $79.17\%$ for standard $k$-NN.
- On CensusIncomeKDD, under-bagging scored $84.59\%$ AM vs. $67.99\%$ for standard $k$-NN.
- Competitive Against Resampling Baselines: Under-bagging outperformed common under-sampling algorithms (ENN, NearMiss, OSS, TomekLinks) by wide margins in both AM accuracy and runtime. Compared to synthetic over-sampling techniques (SMOTE, ADASYN), under-bagging attained comparable or superior AM scores on $5$ out of $9$ datasets while avoiding the heavy computational cost of synthesizing high-dimensional data points.
Limitations and Future Work
- Feature Space Density Assumptions: The theoretical optimality proofs assume uniform marginal feature density ($P_X$ uniform on $[0, 1]^d$). Extending high-probability minimax proofs to arbitrary or unbounded support remains open.
- Heuristic Parameter Tuning: Although the paper provides asymptotic orders for $s$, $k$, and $B$, practical deployments still rely on cross-validation to select exact hyperparameters.
- High-Dimensional Scaling: While the time complexity relative to sample size $n$ improves dramatically, nearest-neighbor searches in extremely high dimensions ($d \gg 1$) still suffer from distance concentration (the curse of dimensionality).
Summary updated