NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

An efficient K-means algorithm for Massive Data

Marco Capó, Aritz Pérez, José Antonio LozanoarXiv 2016

Abstract

Standard K-means clustering faces significant scalability challenges when applied to massive datasets due to its $O(nKd)$ complexity per iteration. This paper introduces Recursive Partition Based K-means (RPKM), an algorithm that summarizes data into weighted representatives through recursive partitioning. By executing a weighted version of K-means on these small summaries and iteratively refining them, RPKM reduces distance computations by up to six orders of magnitude while maintaining approximation quality comparable to K-means++.

Introduction

The $K$-means algorithm is a fundamental tool in data mining, yet its standard implementation, Lloyd’s algorithm, becomes a computational bottleneck as dataset sizes ($n$) reach millions or billions of points. Furthermore, the algorithm's sensitivity to initialization often necessitates multiple passes over the data (e.g., via $K$-means++), compounding the overhead. While stochastic methods like Mini-batch $K$-means offer speed, they frequently sacrifice cluster quality. RPKM aims to bridge this gap, providing the speed of mini-batching with the accuracy of full-scale $K$-means.

The RPKM Algorithm

The core of RPKM lies in a "coarse-to-fine" iterative strategy. The algorithm operates in two primary phases:

  1. Recursive Partitioning: The dataset is partitioned into subsets, each represented by its center of mass (location) and cardinality (weight). This effectively "summarizes" the data.
  2. Weighted Lloyd’s Algorithm (WL): A modified K-means algorithm operates on these weighted representatives. Since the number of representatives is significantly smaller than $n$, computational costs drop drastically.

The process begins with a coarse partition and progressively refines it. Each iteration involves an update step and an assignment step to minimize clustering and centroid errors.

The iterative update and assignment steps of the RPKM algorithm.

Theoretical analysis ensures that the number of iterations required at each refinement level is bounded, preventing redundant clustering across levels. Crucially, the initial computational cost is tied to the grid geometry rather than the total number of points, making the algorithm highly scalable as $n$ grows.

Experimental Results

RPKM was evaluated using synthetic Gaussian mixtures and the real-world Gas Sensor Array dataset, which contains over 4 million instances.

  • Efficiency: RPKM achieved a reduction in distance computations of 4 to 6 orders of magnitude compared to $K$-means++ and Mini-batch $K$-means in low-dimensional, high-$n$ scenarios.
  • Accuracy: The standardized error typically drops below 10% within just three iterations and becomes negligible by the fifth iteration relative to the full $K$-means solution.
  • Scalability: Unlike mini-batch methods, RPKM's relative efficiency improves as the dataset size increases, as the initial summary stages remain independent of $n$.

Conclusion and Future Work

RPKM provides a highly efficient alternative for clustering massive datasets. While the current grid-based partitioning faces challenges in very high-dimensional spaces ($d > 10$) due to exponential scaling, it excels in common data mining tasks. Future research will explore alternative partitioning strategies to mitigate the curse of dimensionality and leverage parallel computing frameworks like Apache Spark to further enhance performance on distributed systems.

Summary updated

BibTeX
@misc{capo2016efficient,
  author = {Marco Capó and Aritz Pérez and José Antonio Lozano},
  title = {{An efficient K-means algorithm for Massive Data}},
  year = {2016},
  eprint = {1605.02989},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1605.02989},
}
Figure