Clustering Small Samples with Quality Guarantees: Adaptivity with\n One2all pps

Edith Cohen, Shiri Chechik, Haim Kaplan

Abstract

Clustering is a fundamental tool in data analysis. We consider points $X$ in a relaxed metric space and address two primary tasks: cost estimation and clustering optimization. To handle massive datasets, we develop efficient constructions of small samples that serve as surrogates for the full data. We introduce the one2all construction of multi-objective probability-proportional-to-size (pps) samples. This method allows the clustering cost of any query $Q$ to be estimated accurately from a small sample. Furthermore, we design an adaptive wrapper that applies base clustering algorithms to the smallest possible sample that provides statistical guarantees. Experimental results show that our adaptive methods achieve sample sizes up to 90x smaller than worst-case theoretical bounds.

Introduction

As datasets scale to millions of points, traditional clustering algorithms like $k$-means become computationally prohibitive. Coresets—small, weighted samples that approximate the full dataset—are the standard solution. However, existing coreset constructions often suffer from a "Goldilocks" problem: they are either based on worst-case bounds that result in unnecessarily large samples, or they rely on restrictive distributional assumptions.

This work introduces an adaptive approach that leverages the inherent structure of real-world data to minimize sample size while maintaining rigorous quality guarantees.

Methodology

The One2all Construction

The core of our design is the one2all construction. Standard pps sampling is effective for estimating the cost of a single clustering, but fails when the goal is to estimate costs for all possible clusterings of size $k$.

The one2all method efficiently assigns sampling probabilities to points based on a set of "anchor" centroids $M$. It ensures that for any clustering $Q$ with a cost $V(Q)$ comparable to $V(M)$, the cost can be estimated accurately from a sample of size $O(\alpha |M| \epsilon^{-2})$. A key theoretical contribution is proving that the overhead for this multi-objective estimation is independent of the data's dimensionality.

Visualization of the one2all sampling mechanism, showing data points (black), anchor centroids (red), and query points (blue) within a partitioned metric space.

The Adaptive Wrapper

To further optimize efficiency, we implement an adaptive wrapper for clustering tasks. Instead of relying on a fixed sample size, the wrapper:

  1. Initializes: Generates an initial small sample using a quick pass (e.g., $k$-means++).
  2. Clusters: Performs clustering on this sample.
  3. Validates: Tests the resulting centroids against the full dataset (or a validation sample) to verify if the error $\epsilon$ is within bounds.
  4. Adapts: If the guarantee is not met, it adaptively increases the sample size and repeats the process.

This feedback loop ensures the algorithm uses the minimum sample size required for the specific dataset's structure.

Experimental Evaluation

The method was evaluated on synthetic Gaussian mixtures and real-world datasets including MNIST and Fashion MNIST (600,000 images each).

Key Results

  • Efficiency Gains: The adaptive method achieved sample sizes 16x to 94x smaller than those suggested by worst-case coreset theory.
  • Dimensionality Independence: Performance remained robust even on high-dimensional data (e.g., $d=784$ for MNIST), confirming that the sample size depends primarily on $k$ and $\epsilon$.
  • Accuracy: On MNIST, a sample of only ~3.7% of the data was sufficient to provide a 20% quality guarantee, with actual errors consistently falling well below the requested $\epsilon$.

Conclusion

The one2all construction and adaptive wrapper provide a powerful framework for scaling clustering to massive datasets. By moving away from worst-case bounds and toward data-dependent adaptivity, we can achieve significant computational savings without sacrificing theoretical rigor. Future work includes extending these sketching techniques to other data analysis tasks such as quantile aggregates and weighted Jaccard similarity.

Summary updated

Abstract

Clustering of data points is a fundamental tool in data analysis. We consider\npoints $X$ in a relaxed metric space, where the triangle inequality holds\nwithin a constant factor. The {\\em cost} of clustering $X$ by $Q$ is\n$V(Q)=\\sum_{x\\in X} d_{xQ}$. Two basic tasks, parametrized by $k \\geq 1$, are\n{\\em cost estimation}, which returns (approximate) $V(Q)$ for queries $Q$ such\nthat $|Q|=k$ and {\\em clustering}, which returns an (approximate) minimizer of\n$V(Q)$ of size $|Q|=k$. With very large data sets $X$, we seek efficient\nconstructions of small samples that act as surrogates to the full data for\nperforming these tasks. Existing constructions that provide quality guarantees\nare either worst-case, and unable to benefit from structure of real data sets,\nor make explicit strong assumptions on the structure. We show here how to avoid\nboth these pitfalls using adaptive designs.\n At the core of our design is the {\\em one2all} construction of\nmulti-objective probability-proportional-to-size (pps) samples: Given a set $M$\nof centroids and $\\alpha \\geq 1$, one2all efficiently assigns probabilities to\npoints so that the clustering cost of {\\em each} $Q$ with cost $V(Q) \\geq\nV(M)/\\alpha$ can be estimated well from a sample of size $O(\\alpha\n|M|\\epsilon^{-2})$. For cost queries, we can obtain worst-case sample size\n$O(k\\epsilon^{-2})$ by applying one2all to a bicriteria approximation $M$, but\nwe adaptively balance $|M|$ and $\\alpha$ to further reduce sample size. For\nclustering, we design an adaptive wrapper that applies a base clustering\nalgorithm to a sample $S$. Our wrapper uses the smallest sample that provides\nstatistical guarantees that the quality of the clustering on the sample carries\nover to the full data set. We demonstrate experimentally the huge gains of\nusing our adaptive instead of worst-case methods.\n
BibTeX
@misc{cohen2017clustering,
  author = {Edith Cohen and Shiri Chechik and Haim Kaplan},
  title = {{Clustering Small Samples with Quality Guarantees: Adaptivity with\textbackslash\{\}n One2all pps}},
  year = {2017},
  eprint = {1706.03607},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1706.03607},
}
Figure