Breathing K-Means: Superior K-Means Solutions through Dynamic K-Values
Bernd Fritzke
TL;DR
Breathing K-Means addresses the locality of standard Lloyd-based clustering by dynamically varying the codebook size through breathing cycles: inserting $m$ centroids near high-error regions and deleting $m$ low-utility centroids, with a freezing mechanism to prevent detrimental removals. The method alternates insertions and deletions with subsequent Lloyd refinements and terminates when improvements plateau, achieving non-local improvements over the baseline greedy k-means++ initialization. Across 51 diverse problems, Breathing K-Means consistently outperforms greedy k-means++ and nearly all competitors in solution quality, while maintaining favorable CPU-time characteristics, often matching or beating ten runs of baselines with a single run. The work positions breathing cycles as a robust, scalable enhancement to seeding procedures in k-means, offering a practical alternative to existing methods in scikit-learn pipelines. $\phi(\mathcal{C},\mathcal{X})$ minimization under dynamic codebooks yields strong empirical gains with limited extra computational burden.
Abstract
We introduce the breathing k-means algorithm, which on average significantly improves solutions obtained by the widely-known greedy k-means++ algorithm, the default method for k-means clustering in the scikit-learn package. The improvements are achieved through a novel ``breathing'' technique, that cyclically increases and decreases the number of centroids based on local error and utility measures. We conducted experiments using greedy k-means++ as a baseline, comparing it with breathing k-means and five other k-means algorithms. Among the methods investigated, only breathing k-means and better k-means++ consistently outperformed the baseline, with breathing k-means demonstrating a substantial lead. This superior performance was maintained even when comparing the best result of ten runs for all other algorithms to a single run of breathing k-means, highlighting its effectiveness and speed. Our findings indicate that the breathing k-means algorithm outperforms the other k-means techniques, especially greedy k-means++ with ten repetitions, which it dominates in both solution quality and speed. This positions breathing k-means (with the built-in initialization by a single run of greedy k-means++) as a superior alternative to running greedy k-means++ on its own.
