Finding Subcube Heavy Hitters in Data Streams

Branislav Kveton, S. Muthukrishnan, Hoa T. VuarXiv 2017 · OpenReview

Introduction

In modern digital analytics, data is often generated as high-dimensional streams. Each record might include a user's browser, geographic location, device type, and specific click actions. For analysts, the most valuable insights often come from identifying "heavy hitters"—items that appear with high frequency. However, the real challenge lies in identifying subcube heavy hitters: frequent combinations of specific subsets of dimensions, such as "Chrome users in London who clicked a specific advertisement."

As the number of dimensions ($d$) increases, the number of possible subcubes grows exponentially, leading to the "curse of dimensionality." Traditional one-pass sampling algorithms typically require space that scales quadratically ($O(d^2)$) to provide theoretical guarantees. In environments with thousands of dimensions and limited memory, these traditional methods become computationally prohibitive. This paper proposes a model-based approach that breaks this quadratic bottleneck, reducing space complexity to $O(d)$ while maintaining high accuracy.

Methodology: From Model-Free to Model-Based

The authors shift the paradigm from "model-free" sampling toward a structured model-based approach. The core idea is to leverage probabilistic assumptions about the data distribution to reconstruct joint frequencies from marginal data.

The Naive Bayes Assumption

While assuming pure independence between dimensions is often too simplistic, the authors adopt a Naive Bayes model. In this framework, dimensions are assumed to be independent conditioned on a latent class variable (e.g., a specific user segment). This structural prior allows the algorithm to estimate the frequency of a combination by calculating the product of the frequencies of its individual components within a given segment.

The Two-Pass Algorithm

To implement this model efficiently, the researchers developed a two-pass strategy:

  1. Pass 1: The algorithm uses a standard streaming method (such as the Misra-Gries algorithm) to identify heavy hitter candidates within each individual dimension.
  2. Pass 2: The algorithm precisely estimates the frequencies of these candidates. Using the Naive Bayes formula, it then reconstructs the joint frequencies of the subcubes.

To handle the retrieval of these items, the authors introduced a fast algorithm for answering AllQuery(T). This allows the system to find all frequent combinations for a subcube in $O((k/\gamma)^2)$ time, successfully avoiding the exponential explosion typically associated with the Cartesian products of frequent items.

Experimental Evaluation

The researchers evaluated the proposed approach across three distinct datasets to test both theoretical bounds and real-world applicability:

  • Synthetic Data: Designed to conform strictly to a Naive Bayes model to validate theoretical performance.
  • Adobe Clickstream Data: A real-world advertising dataset featuring 19 high-cardinality variables (e.g., geography, page metadata) across approximately 168,000 records.
  • Yandex Search Data: A massive dataset containing over 167 million data points, where search results serve as variables and the "day of query" acts as the latent variable.

Key Insights and Results

Breaking the Quadratic Bottleneck

By assuming a probabilistic structure, the algorithm reduces space complexity from $O(kd/\gamma)$ to $O(d/\gamma)$. This shift makes the algorithm practical for high-dimensional streams where traditional sampling would exceed memory limits.

Accuracy and Memory Efficiency

In memory-constrained environments (where memory is less than 1% of the total data size), the model-based heuristic consistently outperformed reservoir sampling. On the Yandex and Adobe datasets, the TwoPassAlg successfully identified nearly all true heavy hitters while reporting significantly fewer false positives than both standard sampling and one-pass independence heuristics.

Structural Priors for Sketches

While general-purpose sketches like Count-Min are standard in the field, this research demonstrates that incorporating knowledge of the data's type (e.g., its adherence to a Naive Bayes distribution) allows for far more efficient "sketched" representations.

Limitations and Future Directions

Despite its efficiency, the approach has certain trade-offs. The most accurate version requires two passes over the data, which may not be feasible for "firehose" scenarios where data cannot be temporarily stored. Additionally, the algorithm's performance is tied to the model fit; highly correlated dimensions that violate the Naive Bayes assumption could lead to decreased accuracy.

Future work may involve extending this model-based framework to other streaming tasks, such as anomaly detection or clustering, and exploring methods to learn latent dimensions automatically from a stream in a single pass.

Summary updated

Abstract

Data streams typically have items of large number of dimensions. We study the fundamental heavy-hitters problem in this setting. Formally, the data stream consists of $d$-dimensional items $x_1,\ldots,x_m \in [n]^d$. A $k$-dimensional subcube $T$ is a subset of distinct coordinates $\{ T_1,\cdots,T_k \} \subseteq [d]$. A subcube heavy hitter query ${\rm Query}(T,v)$, $v \in [n]^k$, outputs YES if $f_T(v) \geq \gamma$ and NO if $f_T(v) < \gamma/4$, where $f_T$ is the ratio of number of stream items whose coordinates $T$ have joint values $v$. The all subcube heavy hitters query ${\rm AllQuery}(T)$ outputs all joint values $v$ that return YES to ${\rm Query}(T,v)$. The one dimensional version of this problem where $d=1$ was heavily studied in data stream theory, databases, networking and signal processing. The subcube heavy hitters problem is applicable in all these cases. We present a simple reservoir sampling based one-pass streaming algorithm to solve the subcube heavy hitters problem in $\tilde{O}(kd/\gamma)$ space. This is optimal up to poly-logarithmic factors given the established lower bound. In the worst case, this is $\Theta(d^2/\gamma)$ which is prohibitive for large $d$, and our goal is to circumvent this quadratic bottleneck. Our main contribution is a model-based approach to the subcube heavy hitters problem. In particular, we assume that the dimensions are related to each other via the Naive Bayes model, with or without a latent dimension. Under this assumption, we present a new two-pass, $\tilde{O}(d/\gamma)$-space algorithm for our problem, and a fast algorithm for answering ${\rm AllQuery}(T)$ in $O(k/\gamma^2)$ time. Our work develops the direction of model-based data stream analysis, with much that remains to be explored.
BibTeX
@misc{kveton2017finding,
  author = {Branislav Kveton and S. Muthukrishnan and Hoa T. Vu},
  title = {{Finding Subcube Heavy Hitters in Data Streams}},
  year = {2017},
  eprint = {1708.05159},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1708.05159},
}
Figure