QuicK-means: Acceleration of K-means by learning a fast transform

Luc Giffon, Valentin Emiya, Liva Ralaivola, Hachem KadriarXiv 2019

Abstract

K-means clustering is a cornerstone of unsupervised learning, yet its computational complexity scales linearly with the number of data points, clusters, and dimensions, creating a bottleneck for large-scale applications. This paper introduces QuicK-means, an accelerated variant that approximates the centroid matrix as a product of learned sparse matrices. By treating the centroid matrix as a fast operator—analogous to a learned Fast Fourier Transform—QuicK-means significantly reduces the cost of the cluster assignment step. We demonstrate that this approach achieves substantial speedups on high-dimensional datasets while maintaining competitive accuracy and guaranteed convergence.

Introduction

The standard K-means algorithm, specifically Lloyd’s algorithm, faces a significant computational hurdle in the assignment step. For $N$ data points, $K$ clusters, and $D$ dimensions, calculating distances to every centroid requires $O(NKD)$ operations per iteration. As datasets grow in all three dimensions, this linear scaling becomes prohibitive. QuicK-means addresses this by borrowing concepts from signal processing and sparse matrix factorization to approximate the centroid matrix with a "learned fast transform."

Methodology

The core innovation of QuicK-means is representing the $K \times D$ centroid matrix $U$ as a product of $Q$ sparse matrices: $U \approx S_1 S_2 \dots S_Q$. This structure is inspired by the Fast Fourier Transform (FFT), but unlike the fixed coefficients of the FFT, QuicK-means learns these sparse factors directly from the data.

The algorithm iterates through two main steps:

  1. Assignment Step: Utilizing the sparse factorization, the algorithm performs fast matrix-vector multiplications to assign points to clusters. This reduces complexity from $O(KD)$ to approximately $O(A \log A + B)$, where $A = \min(K, D)$.
  2. Update Step: After computing standard cluster means, the algorithm employs the palm4MSA (Proximal Alternating Linearized Minimization for Multi-layer Sparse Approximation) algorithm to find the optimal sparse-product approximation for the updated centroids.

The authors provide a formal proof that this iterative scheme is non-increasing, ensuring convergence to a local minimum similar to standard K-means.

Experimental Setup

The performance of QuicK-means was evaluated across several benchmarks, including MNIST, Fashion-MNIST, and a high-dimensional synthetic "Blobs" dataset designed to test scalability.

Table 1: Characteristics of the datasets used for evaluation, including data dimensionality (D) and sample sizes (N).

Results and Discussion

Empirical results demonstrate that QuicK-means provides significant computational advantages as data dimensionality increases. On the "Blobs" dataset, the assignment step achieved speedups of 3x to 5x compared to standard K-means, depending on the chosen sparsity level.

Figure 1: Average running time versus data dimensionality D. QuicK-means (Sparsity levels 2, 4, 8) shows significantly better scaling than the dense baseline as D increases.

While there is an inherent trade-off between sparsity and accuracy, the "sparse" centroids remain visually recognizable and effective for downstream tasks like Nyström approximation. In nearest-neighbor tasks, although some accuracy is sacrificed for extreme speed (e.g., dropping from 0.99 to 0.74 on Blobs in specific high-sparsity configurations), the gains in inference efficiency are substantial.

Conclusion and Future Work

QuicK-means successfully bridges the gap between fixed fast transforms and data-driven clustering. By learning a custom fast operator for centroids, it enables efficient scaling to high-dimensional, large-scale datasets. Future work includes optimizing the factorization overhead of the palm4MSA step and developing mini-batch versions for truly massive, out-of-core datasets.

Summary updated

BibTeX
@misc{giffon2019quick,
  author = {Luc Giffon and Valentin Emiya and Liva Ralaivola and Hachem Kadri},
  title = {{QuicK-means: Acceleration of K-means by learning a fast transform}},
  year = {2019},
  eprint = {1908.08713},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1908.08713},
}
Figure