Abstract
The k-means++ algorithm is a cornerstone of unsupervised learning, providing strong theoretical guarantees for centroid initialization. However, its computational cost—particularly in local search variants—scales poorly with high-dimensional data ($d$) and large cluster counts ($k$), typically requiring $O(ndk^2)$ time. This paper presents FastKMeans++, an optimized algorithm that reduces this complexity to a nearly optimal $O(nd + nk^2)$. By decoupling dimensionality from the iterative search process through Johnson-Lindenstrauss sketching and a specialized Distance Oracle data structure, FastKMeans++ maintains constant-approximation guarantees while significantly accelerating performance on massive, high-dimensional datasets.
Introduction
Clustering is a fundamental task in data science, with the k-means algorithm serving as the industry standard. Despite its popularity, k-means is highly sensitive to initial cluster centers. The k-means++ initialization method addressed this by providing an $O(\log k)$ approximation guarantee. To achieve even tighter constant-approximation results, researchers often employ "local search" variants.
However, in the era of Big Data, where the number of points ($n$) and dimensionality ($d$) frequently reach the millions, these local search algorithms encounter a significant bottleneck. Current state-of-the-art methods require $O(k)$ iterations, with each iteration recalculating distances across all dimensions, leading to a total complexity of $O(ndk^2)$. This paper introduces FastKMeans++ to break this multiplicative $ndk^2$ barrier, making high-quality clustering feasible for large-scale applications.
Methodology
The primary innovation of FastKMeans++ is the decoupling of the high-dimensional space from the iterative refinement process. The algorithm achieves this through two core components:
1. Johnson-Lindenstrauss (JL) Sketching
Rather than performing all calculations in the original $d$-dimensional space, the algorithm projects the data into a lower-dimensional space ($m$) using a sketching matrix. According to the Johnson-Lindenstrauss Lemma, these "sketches" preserve the pairwise distances between points within a small error margin ($\epsilon$). This allows the algorithm to perform the bulk of its iterative work in a computationally cheaper environment.
2. The Distance Oracle
To manage these sketches efficiently, the authors developed a specialized "Distance Oracle" data structure. This structure maintains a balanced search tree for every data point to track its proximity to the nearest cluster centers. The oracle supports efficient Insert, Delete, and Query operations. By utilizing this structure, the algorithm only incurs the full cost of the $d$ dimensions once during the initial sketching phase. Subsequent local search iterations occur within the sketched space, drastically lowering the per-iteration cost.
Theoretical Contributions
The resulting complexity of FastKMeans++ is $O(nd + nk^2)$. This is a significant theoretical improvement because the $d$ and $k^2$ terms are now additive rather than multiplicative. In scenarios where $k = O(\sqrt{d})$, the algorithm achieves essentially optimal running time. Furthermore, the authors mathematically prove that despite the use of dimensionality reduction, FastKMeans++ still achieves a constant approximation ratio in expectation, ensuring that accuracy is not sacrificed for speed.
Experimental Evaluation
Datasets
The authors benchmarked FastKMeans++ against standard local search k-means++ using synthetic data and four real-world datasets from the UCI Machine Learning Repository:
- SCADI: Physical/motor disability data (70 instances, 206 attributes).
- MUPCI: User-perceived clusters in images (180 images, 500 features).
- Libras Movement (LM): Hand movement gestures (360 instances, 91 features).
- STDW: Sales Transactions Weekly data (811 instances, 53 features).
Key Results
- Scalability with $n$: Empirical tests showed that as the number of points ($n$) increased, the original algorithm's runtime grew significantly faster than that of FastKMeans++.
- Dimensionality Independence: Experiments confirmed that while the original algorithm's runtime scales linearly with $d$, FastKMeans++ remains largely unaffected by dimensionality after the initial sketching phase.
- Cluster Scaling: While both algorithms exhibit quadratic scaling with the number of clusters ($k^2$), FastKMeans++ maintains a much lower baseline runtime.
- High-Dimensional Performance: On datasets like SCADI and MUPCI, which feature high attribute counts, FastKMeans++ demonstrated a clear and consistent speed advantage.
Conclusion and Future Work
FastKMeans++ represents a major advancement in making high-quality clustering scalable. By reducing the complexity from $O(ndk^2)$ to $O(nd + nk^2)$, the authors have provided a tool capable of handling the high-dimensional demands of modern machine learning.
Future research directions include establishing formal theoretical lower bounds for the k-means++ initialization problem and optimizing the memory overhead of the Distance Oracle, which currently requires $O(n(d+k))$ space. Additionally, exploring the sensitivity of the precision parameter $\epsilon$ across different data distributions could further refine the algorithm's practical application.
Summary updated