Near-Optimal k-Clustering in the Sliding Window Model

David P. Woodruff, Peilin Zhong, Samson Zhou · DOI

In the world of big data, we often face a "drink from a firehose" problem. We want to find patterns—like clusters of similar data points—but the stream is too fast and too large to store everything. To make matters more complicated, data often has an expiration date. In financial markets or social media monitoring, a trend from three years ago is often irrelevant; we only care about the "sliding window" of the most recent data.

In their recent paper, David P. Woodruff, Peilin Zhong, and Samson Zhou present a breakthrough algorithm for $(k,z)$-clustering in this sliding window model. Their work provides the first near-optimal $(1+\varepsilon)$-approximation, significantly slimming down the memory required to keep track of clusters in real-time.

TL;DR

The authors introduce the first algorithm for $(k,z)$-clustering (generalizing $k$-means and $k$-median) in the sliding window model that achieves a near-optimal $(1+\varepsilon)$-approximation while using only polylogarithmic space. They achieve this by developing a novel "online coreset"—a data summary that remains valid for every prefix of a data stream—and prove that maintaining such a summary is fundamentally harder than traditional offline clustering.

What Problem Does This Paper Address?

Clustering is the bread and butter of data analysis, but traditional algorithms assume you have the whole dataset sitting on a hard drive. In streaming scenarios, we only see points once. The sliding window model adds a layer of difficulty: we only care about the $W$ most recent points. Older points "expire" and must be discarded.

The specific problem studied is $(k,z)$-clustering. Given a set of points, find $k$ centers that minimize the sum of the distances to the power of $z$.

  • If $z=1$, it’s the $k$-median problem.
  • If $z=2$, it’s the $k$-means problem.

Previous sliding window algorithms were either stuck with "constant-factor" approximations (meaning they could be off by a fixed percentage) or they required massive amounts of memory that scaled poorly with the number of dimensions ($d$) or the required accuracy ($\varepsilon$).

Methods

The authors' approach relies on three main pillars:

  1. Online Coresets: A "coreset" is a tiny, weighted subset of data that acts as a proxy for the full set. Usually, coresets are built for a static batch of data. The authors develop an online coreset that provides a valid summary not just for the whole stream, but for every possible prefix of the stream.
  2. Consistent Approximations: To build the coreset online, the algorithm needs a rough idea of where the clusters are at all times. They use a modified Meyerson sketch (an online facility location algorithm). Crucially, they ensure the approximation is "consistent"—once a point is assigned to a rough cluster, that assignment doesn't change, which allows for stable sampling.
  3. Reverse Merge-and-Reduce: Standard streaming algorithms use a "merge-and-reduce" tree to combine summaries. However, this fails in sliding windows because the "old" parts of the tree expire. The authors adapt this framework to work in reverse order of arrival. By feeding points into an online coreset construction backwards, they ensure the summary is always optimized for the most recent "suffix" of the data (the sliding window).

Datasets

The paper evaluates the algorithm using both synthetic and real-world data:

  • SKIN (Skin Segmentation) Dataset: A UCI repository dataset with ~245,000 points used to identify skin textures in images. The authors added synthetic noise to test how well the algorithm handles outliers that appear and then expire.
  • Synthetic Gaussian Clusters: They generated 200,001 points forming distinct clusters in 2D space, specifically designed with "distractor" points at the start of the stream to see if baselines would get "stuck" on expired data.

Key Insights and Ideas

  • The "Online" Tax: The authors prove a "separation" between offline and online coresets. They show that any online coreset requires an extra factor of $\log n$ space. In other words, being ready to answer a query at any time is mathematically harder than just answering at the end.
  • Irrevocability: A key feature of their online coreset is that once a point is sampled, it is never deleted until it expires. This makes the data structure incredibly robust for real-time systems.
  • Dimensionality Independence: By using "terminal embeddings," the algorithm's space complexity becomes nearly independent of the original dimension $d$, making it suitable for very high-dimensional data.

Key Results

  • Space Efficiency: The algorithm uses roughly $\frac{k}{\varepsilon^4} \text{polylog}(n)$ space. For $k$-means and $k$-median, this matches known lower bounds up to logarithmic factors.
  • Accuracy: It provides a $(1+\varepsilon)$-approximation, meaning you can get as close to the mathematically perfect clustering as your memory allows.
  • Empirical Performance: In experiments, their "importance sampling" approach (labeled imp) significantly outperformed uniform sampling and standard histogram-based methods. On synthetic datasets with noise, the error rates of older methods were orders of magnitude higher because they couldn't effectively "forget" the influence of expired noisy points.

Limitations and Future Work

  • Aspect Ratio Dependence: The space complexity includes a $\log \Delta$ term, where $\Delta$ is the "aspect ratio" (the ratio between the farthest and closest points). While common in this field, finding an algorithm that is truly independent of the geometry of the space remains a challenge.
  • The Sliding Window Gap: While they proved that online coresets need a $\log n$ overhead, they leave open the question of whether a sliding window algorithm (which doesn't necessarily need to be an online coreset) could be even more efficient.
  • Computational Complexity: The paper focuses on space (memory) optimality. While the algorithm is polynomial-time, optimizing the per-point processing time for ultra-high-speed hardware is a potential next step.

Summary updated

BibTeX
@inproceedings{woodruff2023near,
  author = {David P. Woodruff and Peilin Zhong and Samson Zhou},
  title = {{Near-Optimal k-Clustering in the Sliding Window Model}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=8XRMbNAP6Z},
}
Figure