Near-Linear Time Approximation Algorithms for k-means with Outliers

Junyu Huang, Qilong Feng, Ziyun Huang, Jinhui Xu, Jianxin Wang

Introduction

Standard $k$-means clustering is notoriously sensitive to noise; a single distant outlier can pull a cluster center far away from the actual data mass. To address this, the $k$-means with outliers problem allows the algorithm to "ignore" a specified number of points ($z$) to find the best clustering for the remaining data.

However, finding the optimal $z$ outliers is computationally expensive. Existing fast approximation algorithms usually suffer from a hidden bottleneck: their running time depends heavily on the aspect ratio ($\Delta$) of the data (the ratio of maximum to minimum pairwise distances). If points are very spread out or tightly packed in different regions, $\Delta$ becomes huge, drastically slowing down these algorithms. Furthermore, many methods require "guessing" the optimal clustering cost beforehand, which is impractical for real-world applications.

This paper introduces new sampling-based algorithms that achieve near-linear running time. Crucially, their core sampling approach is independent of the dataset's aspect ratio, making it significantly more scalable for massive, high-dimensional datasets.

Proposed Methods

The authors propose a two-stage strategy to find "good" inliers (points near the true cluster centers) without needing to know the optimal cost or the aspect ratio.

  1. Fast-Sampling: This core innovation uses a two-stage process of Probability Boosting (oversampling points to ensure inliers make up a significant fraction) and Probability Normalization (ensuring a high probability of picking exactly one inlier close to an optimal center per iteration). This algorithm produces a 4-approximation in $O(\frac{ndk\log\log n}{\epsilon^2})$ time. However, it opens $O(k/\epsilon)$ centers rather than exactly $k$, while discarding $(1+\epsilon)z$ outliers.
  2. Center-Reduction: To get back to exactly $k$ centers, the authors use the results of Fast-Sampling to create a smaller, weighted version of the problem. They then run a more traditional algorithm on this reduced dataset to find the final $k$ centers, achieving an $O(1/\epsilon)$-approximation.
Comparison of theoretical results without assumptions. The proposed algorithms achieve near-linear time complexity, with the first method completely removing the aspect ratio dependency.

Key Insights

  • Bypassing the "Guess": Most previous fast algorithms needed to guess the optimal clustering cost to "trim" distances. By using an adaptive oversampling factor, this paper removes the need for that guess during the sampling phase.
  • The $(1+\epsilon)z$ Trade-off: Theoretical lower bounds show that achieving near-linear time requires allowing the algorithm to discard slightly more than $z$ outliers. By allowing this tiny bit of extra slack ($(1+\epsilon)z$), the authors unlock massive speed gains.
  • Independence from $\Delta$: By decoupling the sampling probability from absolute distances via normalization, the algorithm's performance no longer degrades when the data has a poor aspect ratio.

Experimental Results

The researchers evaluated their algorithms (TIKmeans and IKmeans) against state-of-the-art competitors like RobustKmeans++ and LS++ on several large-scale datasets, including Skin ($d=3$), SUSY ($d=18$), Shuttle ($d=9$), KDDFULL ($d=37$), and the massive 100-million-point SIFT dataset ($d=128$).

  • Speed: On the SIFT dataset, their IKmeans algorithm was significantly faster than others, while competitors like NKmeans and LS++ timed out. Across all tests, IKmeans was consistently at least 20% faster than the next best state-of-the-art method.
  • Quality: The TIKmeans algorithm consistently achieved lower clustering costs (better fit). For example, on the Skin-5 and Shuttle datasets, it reduced clustering costs by 4.43% and 21.16% respectively compared to RobustKmeans++.
  • Scalability: The algorithms maintain high "Recall" (the ability to correctly identify ground-truth outliers) even as the dataset size grows.
Experimental results comparing cost, recall, and time across various datasets. Note that for the massive SIFT dataset, several competitors timed out (>72h).

Limitations and Future Work

While the initial sampling part of the algorithm is independent of the aspect ratio $\Delta$, the Center-Reduction stage (which brings the number of centers back down to exactly $k$) still retains a logarithmic dependency on $\Delta$ in its theoretical time complexity.

Future research could explore whether it's possible to achieve a constant-factor approximation with exactly $k$ centers in time that is completely independent of the aspect ratio, or if there is a fundamental theoretical limit preventing this. Additionally, while the algorithm handles $(1+\epsilon)z$ outliers efficiently, some strict applications might require exactly $z$ outliers, which remains a challenging problem for massive datasets.

Summary updated

BibTeX
@inproceedings{huang2024near,
  author = {Junyu Huang and Qilong Feng and Ziyun Huang and Jinhui Xu and Jianxin Wang},
  title = {{Near-Linear Time Approximation Algorithms for k-means with Outliers}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=EHjm3sXPFy},
}
Figure