Skip to main content
QUICK REVIEW

[Paper Review] Fast Exact k-Means, k-Medians and Bregman Divergence Clustering in 1D

Allan Grønlund, Kasper Green Larsen|arXiv (Cornell University)|Jan 25, 2017
Automated Road and Building ExtractionEngineering23 references48 citations
TL;DR

This paper presents fast exact algorithms for 1D k-Means, k-Medians, and Bregman divergence clustering using dynamic programming and binary search techniques. It reduces space usage, generalizes to any Bregman divergence, and shows that a binary search-based algorithm outperforms dynamic programming in practice, especially for large n and k, while enabling efficient reporting of optimal clusterings for all k' ≤ k.

ABSTRACT

The $k$-Means clustering problem on $n$ points is NP-Hard for any dimension $d\ge 2$, however, for the 1D case there exists exact polynomial time algorithms. Previous literature reported an $O(kn^2)$ time dynamic programming algorithm that uses $O(kn)$ space. It turns out that the problem has been considered under a different name more than twenty years ago. We present all the existing work that had been overlooked and compare the various solutions theoretically. Moreover, we show how to reduce the space usage for some of them, as well as generalize them to data structures that can quickly report an optimal $k$-Means clustering for any $k$. Finally we also generalize all the algorithms to work for the absolute distance and to work for any Bregman Divergence. We complement our theoretical contributions by experiments that compare the practical performance of the various algorithms.

Motivation & Objective

  • To develop faster and more space-efficient exact algorithms for 1D k-Means clustering, overcoming limitations of prior O(kn²) time and O(kn) space dynamic programming approaches.
  • To generalize existing 1D k-Means algorithms to work with k-Medians and any Bregman divergence, broadening applicability to diverse clustering problems.
  • To enable efficient reporting of optimal clusterings for all k' ≤ k using linear space, a capability not natively supported by standard dynamic programming.
  • To empirically evaluate and compare the performance of various 1D clustering algorithms, including dynamic programming and binary search-based methods.
  • To identify and resolve overlooked prior work, particularly the 1980s quantization algorithm that predates and subsumes later known solutions.

Proposed method

  • Proposes a dynamic programming algorithm with O(kn²) time and O(kn) space, later optimized to O(kn) time and O(k) space by maintaining only the last column of the DP table.
  • Introduces a binary search-based algorithm using interpolation to find the optimal cost λ for k clusters, achieving O(n lg U) time and linear space, where U is the universe size.
  • Leverages the concave property of the cost function to enable efficient binary search over λ, allowing fast computation of optimal clusterings for any k.
  • Generalizes the algorithms to k-Medians using absolute distance and to any Bregman divergence by adapting the cost function and maintaining the same algorithmic structure.
  • Employs a regularized version of the 1D k-Means problem to support efficient computation of optimal clusterings for all k' ≤ k using the binary search framework.
  • Uses a modified Wilber-style interpolation search to accelerate the binary search process, showing strong practical performance despite no theoretical worst-case bound.

Experimental results

Research questions

  • RQ1Can the space complexity of exact 1D k-Means clustering be reduced from O(kn) to O(k) while preserving optimal performance?
  • RQ2Is there a practical and efficient alternative to dynamic programming for exact 1D k-Means clustering that scales better with n and k?
  • RQ3Can the dynamic programming approach be extended to report optimal clusterings for all k' ≤ k efficiently, and how does this compare to binary search-based methods?
  • RQ4Can the algorithms be generalized to k-Medians and Bregman divergences while maintaining the same time and space complexity?
  • RQ5What is the practical performance of the binary search-based algorithm compared to dynamic programming, especially in terms of running time and memory usage for large n and k?

Key findings

  • The binary search-based algorithm achieves O(n lg U) time and linear space, significantly outperforming the O(kn²) dynamic programming approach in practice, especially for large n and k.
  • For the Uniform and Gaussian data sets, the binary search algorithm is substantially faster than dynamic programming when k ≥ 20, even for moderate n.
  • The dynamic programming algorithm can be optimized to use only O(k) space by storing only the last column of the DP table, enabling efficient reporting of optimal clusterings for all k' ≤ k.
  • The binary search algorithm can report optimal clustering costs for multiple values of k during the search process, allowing interactive or incremental visualization of the cost curve.
  • The interpolation-based binary search heuristic performs much better in practice than the worst-case O(n²) bound suggests, indicating strong empirical efficiency.
  • The paper identifies and integrates previously overlooked work from 1980 on 1D weighted quantization, showing that the optimal solution was known decades earlier and subsumes later results.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.