Explainable $k$-Means and $k$-Medians Clustering

Sanjoy Dasgupta, Nave Frost, Michal Moshkovitz, Cyrus Rashtchian

TL;DR

This paper introduces the first algorithms for $k$-means and $k$-medians clustering with provable "explainability" guarantees. By using small decision trees to define clusters, the authors provide a way to categorize data points using simple, axis-aligned rules while maintaining a cost within a provable factor of the mathematically optimal (but opaque) clustering.

What Problem Does This Paper Address?

Clustering is a cornerstone of unsupervised learning, yet its results are often "black boxes." In a standard $k$-means setup, a point belongs to a cluster because it is closer to that cluster's center than any other. In high-dimensional space, this decision depends on a complex, weighted combination of all features. If you're clustering supermarket customers, you might not be able to easily explain why a specific person ended up in "Group A" without citing hundreds of variables.

The authors seek to bridge the gap between performance and interpretability. They propose using threshold trees—unsupervised decision trees where each internal node splits the data based on a single feature (e.g., "Is Income $\le$ \$50k?"). This results in clusters that are axis-aligned rectangles, which are much easier for humans to understand. The core challenge is the "price of explainability": how much clustering quality (cost) do we sacrifice by forcing the clusters to be defined by a simple tree?

Comparison between optimal Voronoi-based clustering and the more interpretable tree-based approach.

Methods

The authors demonstrate that standard greedy decision tree algorithms like ID3 or CART, which minimize entropy, can fail spectacularly in a clustering context, potentially leading to arbitrarily high costs.

Instead, they propose a new algorithm: Iterative Mistake Minimization (IMM).

  1. Reference Clustering: Start by finding a good (but not necessarily explainable) clustering using standard methods like $k$-means++.
  2. Tree Building: Build a tree top-down with $k$ leaves. At each node, the algorithm searches for a feature and a threshold that minimizes "mistakes."
  3. Defining Mistakes: A mistake occurs when a split separates a data point from its assigned reference center.
  4. Efficiency: By using dynamic programming, the algorithm finds the optimal split at each node efficiently, resulting in a total runtime of $O(kdn \log n)$.
The IMM algorithm iteratively splits the data, aiming to keep points with their reference centers while using simple axis-aligned cuts.

Datasets

The paper is primarily a theoretical contribution. Rather than benchmarking on standard large-scale datasets, the authors use synthetic, adversarial data constructions to prove their upper and lower bounds:

  • Standard Basis Vectors: Used to show that a tree might need a depth of $k-1$ to separate $k$ clusters.
  • Random Hypercube Centers: Used to prove the $\Omega(\log k)$ lower bound on the approximation factor.
  • Hamming Distance Clusters: Used to establish tight lower bounds for the $k=2$ case.

Key Insights and Ideas

  • The Price of Explainability is Logarithmic: The authors prove a fundamental limit: for any $k$, there exist datasets where any tree-based clustering must be at least $\Omega(\log k)$ times worse than the optimal unconstrained clustering.
  • Greed is Dangerous: Popular top-down heuristics that work for classification (like maximizing information gain) are unsuitable for clustering. They can ignore outliers that dominate the $k$-means cost.
  • Mistakes as a Proxy for Cost: The "aha moment" is realizing that minimizing the number of points separated from their ideal centers is a powerful enough proxy to bound the total distance-based cost of the resulting clustering.
  • Dimension Independence: Crucially, the approximation guarantees depend only on $k$ (the number of clusters) and the tree depth, not on the number of features ($d$) or the number of points ($n$).

Key Results

The paper provides the first constant and polynomial approximation ratios for explainable clustering:

Objective $k=2$ (Upper / Lower) General $k$ (Upper / Lower)
$k$-medians $2$ / $2 - 1/d$ $O(k)$ / $\Omega(\log k)$
$k$-means $4$ / $3(1-1/d)^2$ $O(k^2)$ / $\Omega(\log k)$

For the $k=2$ case, they show that a single threshold cut is remarkably effective, achieving a near-optimal constant factor approximation. For general $k$, the IMM algorithm provides the first-ever guarantees that don't blow up as the dimensionality of the data increases.

Limitations and Future Work

  • Tightness of Bounds: There is a gap between the $O(k^2)$ upper bound and the $\Omega(\log k)$ lower bound for $k$-means. Closing this gap is a primary open question.
  • Tree Depth vs. Leaves: The current work focuses on trees with exactly $k$ leaves. Allowing more leaves (e.g., $2k$ or $k \log k$) might significantly reduce the approximation error while remaining relatively explainable.
  • Beyond Axis-Aligned Splits: While axis-aligned splits are the gold standard for interpretability, exploring "oblique" splits (linear combinations of a few features) could offer a different trade-off between simplicity and accuracy.
  • Separated Data: The authors suggest that for "well-separated" data (like mixtures of Gaussians), the approximation factors might be much better than the worst-case bounds proven here.

Summary updated

Abstract

Clustering is a popular form of unsupervised learning for geometric data. Unfortunately, many clustering algorithms lead to cluster assignments that are hard to explain, partially because they depend on all the features of the data in a complicated way. To improve interpretability, we consider using a small decision tree to partition a data set into clusters, so that clusters can be characterized in a straightforward manner. We study this problem from a theoretical viewpoint, measuring cluster quality by the $k$-means and $k$-medians objectives: Must there exist a tree-induced clustering whose cost is comparable to that of the best unconstrained clustering, and if so, how can it be found? In terms of negative results, we show, first, that popular top-down decision tree algorithms may lead to clusterings with arbitrarily large cost, and second, that any tree-induced clustering must in general incur an $Ω(\log k)$ approximation factor compared to the optimal clustering. On the positive side, we design an efficient algorithm that produces explainable clusters using a tree with $k$ leaves. For two means/medians, we show that a single threshold cut suffices to achieve a constant factor approximation, and we give nearly-matching lower bounds. For general $k \geq 2$, our algorithm is an $O(k)$ approximation to the optimal $k$-medians and an $O(k^2)$ approximation to the optimal $k$-means. Prior to our work, no algorithms were known with provable guarantees independent of dimension and input size.
BibTeX
@inproceedings{dasgupta2020explainable,
  author = {Sanjoy Dasgupta and Nave Frost and Michal Moshkovitz and Cyrus Rashtchian},
  title = {{Explainable $k$-Means and $k$-Medians Clustering}},
  booktitle = {International Conference on Machine Learning},
  year = {2020},
  url = {https://openreview.net/forum?id=exaf9i6A_t},
}
Figure