A cutting plane algorithm for globally solving low dimensional k-means clustering problems

Martin Ryner, Jan Kronqvist, Johan KarlssonarXiv 2024 · DOI

Abstract

K-means clustering is a fundamental unsupervised learning technique, but finding its global optimum is NP-hard. Most applications rely on local search heuristics like Lloyd's algorithm, which frequently converge to suboptimal solutions. This paper introduces a cutting plane algorithm that guarantees global optimality by reformulating k-means as a concave minimization problem. The approach decouples computational complexity from the number of data points, making it highly effective for large datasets in low-dimensional spaces. Experimental results show significant speedups over general-purpose global solvers and improved clustering accuracy on datasets such as MNIST.

Introduction

K-means clustering is a cornerstone of machine learning, yet its standard implementations—such as Lloyd’s algorithm or k-means++—are local search heuristics. While efficient, these methods are sensitive to initialization and often get trapped in local optima. Finding the absolute best (globally optimal) clustering is theoretically NP-hard.

Existing global optimization frameworks, like Mixed-Integer Nonlinear Programming (MINLP), are often too computationally expensive for practical use. This research addresses the challenge by developing a specialized global solver for "low-dimensional" data. The goal is to provide a method that remains computationally feasible even as the number of data points $n$ grows, provided the number of clusters $k$ and dimensions $d$ remain small.

Methodology

The authors' primary innovation is a Cutting Plane Algorithm that leverages the specific mathematical structure of the k-means objective.

Concave Reformulation and Outer Approximation

The problem is first proven to be equivalent to a concave minimization problem over a set of assignment matrices. A key property of concave functions is that they reach their minimum at the extreme points (the "corners") of their feasible set. To find this minimum, the algorithm employs an iterative outer approximation strategy.

Visualization of the outer approximation and cutting plane process.

As illustrated in Figure 1, the algorithm starts with a simple geometric "envelope" (a simplex) containing all possible solutions. It then iteratively refines this envelope:

  1. Lower Bound: Solve a small concave problem to find a candidate solution.
  2. Upper Bound: Solve a Linear Programming (LP) problem to find a feasible assignment.
  3. Cutting Planes: If the gap between bounds is significant, the algorithm generates a "cutting plane"—a new linear constraint based on the objective's gradient—to slice away regions of the search space that cannot contain the global optimum.

Algorithmic Implementation

The formal procedure, detailed in Algorithm 1, incorporates several acceleration techniques to manage the search space efficiently. These include symmetry breaking (to avoid redundant searches of identical cluster permutations), branching (dividing the search space), and integer constraints (pruning based on discrete cluster sizes).

Pseudocode for the Global k-means algorithm.

Experimental Evaluation

The researchers evaluated the algorithm using both synthetic datasets and real-world data from the MNIST handwritten digit database. For MNIST, they projected a subset of digits ("7" and "9") into a 2D Euclidean space using Wasserstein distance and multidimensional scaling.

Key Results

  • Efficiency: In a benchmark with 50 points ($k=3, d=2$), the proposed method found the global optimum in 54 seconds. In contrast, the industry-standard Gurobi solver failed to reach a 25% optimality gap even after 10,000 seconds.
  • Scalability: The algorithm's complexity is largely decoupled from the number of points $n$. It successfully solved a 5,000-point problem in approximately 31 minutes.
  • Clustering Quality: On the MNIST task, the global algorithm achieved a Purity score of 0.81, significantly higher than the 0.67 achieved by k-means++. This demonstrates that the global optimum provides a more meaningful representation of the underlying data structure.

Discussion and Future Work

The algorithm proves that global k-means is tractable for low-dimensional data, even with large $n$. However, it faces the "curse of dimensionality"; as $k$ or $d$ increases, the number of extreme points grows exponentially, leading to memory bottlenecks. Future research will focus on more sophisticated polytope management and parallelizing the branching process to further enhance performance on modern hardware.

Summary updated

BibTeX
@misc{ryner2024cutting,
  author = {Martin Ryner and Jan Kronqvist and Johan Karlsson},
  title = {{A cutting plane algorithm for globally solving low dimensional k-means clustering problems}},
  year = {2024},
  eprint = {2402.13595},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.13595},
}
Figure