cs.LGApr 23, 2026

An effective variant of the Hartigan k-means algorithm

Authors: François ClémentStefan Steinerberger

Abstract

The k-means problem is perhaps the classical clustering problem and often synonymous with Lloyd's algorithm (1957). It has become clear that Hartigan's algorithm (1975) gives better results in almost all cases, Telgarsky-Vattani note a typical improvement of 5%5\% -- 10%10\%. We point out that a very minor variation of Hartigan's method leads to another 2%2\% -- 5%5\% improvement; the improvement tends to become larger when either dimension or kk increase.

Explore similar work

Jul 15, 2024cs.DS

Faster and Simpler Greedy Algorithm for k-Median and k-Means

Clustering problems such as kk-means and kk-median are staples of unsupervised learning, and many algorithmic techniques have been developed to tackle their numerous aspects. In this paper, we focus on the class of greedy approximation algorithm, that attracted less attention than local-search or primal-dual counterparts. In particular, we study the recursive greedy algorithm developed by Mettu and Plaxton [SIAM J. Comp 2003]. We provide a simplification of the algorithm, allowing for faster implementation, in graph metrics or in Euclidean space, where our algorithm matches or improves the state-of-the-art.
Max Dupré la Tour, David Saulpic
Jul 28, 2026stat.ML

Lloyd's K-Means Clustering Algorithm Is Frank-Wolfe in Disguise

Lloyd's KK-means algorithm, also known as naïve KK-means, is a widely used ad hoc optimization heuristic, designed to minimize the sum of squared errors (SSE) across all KK-partitions of a dataset via iterative cluster refinement. In this work, we establish a novel connection between Lloyd's algorithm and the Frank-Wolfe (FW) algorithm, a prominent first-order method for projection-free optimization. We demonstrate that Lloyd's algorithm is a special case of FW. Leveraging recent advances in FW methods for concave objectives, we derive a non-asymptotic O(1/t)\mathcal{O}(1/t) convergence rate to a local minimum of the SSE objective. To account for empty clusters, an outcome possible under Lloyd's greedy assignment, we develop an FW variant for semismooth objectives while retaining the same convergence rate that is solely controlled by the initial SSE value. We illustrate our findings with a simulation study for spherical Gaussian mixtures and a real-world image segmentation dataset.
Michael Pokojovy, J. Marcus Jobe, Simon Lacoste-Julien
Jul 9, 2026cs.LG

An interpretable Good--Turing restart criterion for k-means++

The k-means++ algorithm is commonly restarted multiple times to avoid poor local optima, yet the number of restarts is almost always chosen arbitrarily and applied uniformly regardless of data set difficulty. This undermines any comparison relying on such a choice and wastes computation on easy data sets while potentially under-serving hard ones. We introduce GTRC, a restart criterion combining a Good-Turing estimate, a proven unconditional bound, and a confidence-based bound on the probability that a further restart would improve on the current result, stopping once this probability falls below a user-specified tolerance ε\varepsilon. Across 36 data sets, GTRC reached clustering quality competitive with well-chosen fixed restart counts, while the number of restarts used varied considerably and appropriately with data set difficulty, governed by an interpretable, data-dependent signal rather than a fixed rule. GTRC offers a principled and reportable alternative to fixing the number of kk-means++ restarts in advance. Software:https://github.com/RCdeAmorim/Good-Turing-Restart-Criterion.
Renato Cordeiro de Amorim