Abstract
Clustering massive datasets is a fundamental challenge in data analysis. Traditional "coreset" methods often rely on worst-case theoretical bounds that lead to impractically large sample sizes. We introduce one2all, a novel adaptive sampling technique that leverages the inherent structure of data to create small surrogate samples with strong statistical guarantees. By shifting from pessimistic "ForAll" guarantees to adaptive "ForEach" guarantees, one2all achieves significant reductions in sample size—up to 94x—while maintaining high accuracy for cost estimation and clustering tasks.
Introduction
Clustering algorithms, such as $k$-means, are computationally intensive because they require repeated distance calculations between every data point and a set of centroids. To scale these algorithms, researchers use coresets—small, weighted samples that approximate the full dataset's cost. However, standard coreset constructions are often based on worst-case scenarios, assuming pathological data distributions. This results in sample sizes that can be nearly as large as the original dataset, defeating the purpose of sampling.
We address this by asking: Can we obtain strong statistical guarantees using much smaller samples by adapting to the actual structure of real-world data? Our solution is the one2all construction, which uses an adaptive design to balance sample size and accuracy.
The one2all Construction
The core of our approach is multi-objective probability-proportional-to-size (pps) sampling. We consider data points $X$ in a relaxed metric space, where the triangle inequality holds within a constant factor. The cost of clustering $X$ by a set of centroids $Q$ is defined as $V(Q) = \sum_{x \in X} d(x, Q)$.
Instead of trying to accurately estimate the cost of every possible set of $k$ centroids (a "ForAll" guarantee), we focus on providing accurate estimates for any specific query (a "ForEach" guarantee). The one2all method takes a reference set of centroids $M$ and an approximation factor $\alpha \geq 1$. It efficiently assigns sampling probabilities to points so that the clustering cost of each $Q$ with $V(Q) \geq V(M)/\alpha$ can be estimated well from a sample of size $O(\alpha |M|\epsilon^{-2})$.
Mathematically, this single set of probabilities upper-bounds the required probabilities for all potential centroid sets with a cost comparable to $M$. This allows the sample to act as a reliable surrogate for a wide range of potential clustering solutions.
Adaptive Frameworks
We implement one2all within two adaptive frameworks designed to minimize sample size based on data complexity:
- Adaptive Cost Oracle: For estimating clustering costs, the algorithm starts with an optimistically small sample. If a queried clustering has a cost lower than what the current sample size can reliably estimate, it triggers a "feedback" mechanism to compute the exact cost and adaptively increase the sample size.
- Adaptive Clustering Wrapper: This meta-algorithm wraps around any base clustering algorithm (like Lloyd's algorithm). It runs the base algorithm on a small one2all sample and then tests the resulting centroids against the full dataset. If the algorithm was "fooled" by the sample (i.e., the sample cost is vastly different from the true cost), the wrapper doubles the sample size and tries again.
Experimental Results
We evaluated the one2all method on synthetic Gaussian mixtures and real-world datasets like MNIST and Fashion MNIST. The results demonstrate massive efficiency gains over traditional worst-case bounds:
- MNIST: While worst-case bounds required 100% of the data (providing zero reduction), one2all achieved the same guarantees using only 3.7% of the data—a 26.9x gain in efficiency.
- Fashion MNIST: The method used only 5.7% of the data, a 17.5x gain over worst-case methods.
- Synthetic Data: On highly clusterable data, we observed up to a 94.4x reduction in sample size.
Crucially, these smaller samples did not sacrifice accuracy; relative errors remained well below the specified tolerance ($\epsilon$).
Conclusion
The one2all construction demonstrates that worst-case bounds are often overkill for real-world data. By using a single reference set to capture data structure and employing adaptive mechanisms, we can drastically reduce the computational overhead of clustering. Future work may extend these multi-objective sampling techniques to other low-rank approximation problems like PCA and SVD.
Summary updated