Abstract
Kernel density estimation (KDE) is a simple and effective method that lies at the heart of many important machine learning applications. Unfortunately, kernel methods scale poorly for large, high-dimensional datasets. Approximate KDE has traditionally faced prohibitively high memory and computation costs, especially in streaming settings. Recent sampling algorithms for high-dimensional densities can reduce computation costs but cannot operate online, while streaming algorithms often fail to handle high-dimensional datasets due to the curse of dimensionality. We propose RACE, an efficient sketching algorithm for KDE on high-dimensional streaming data. RACE compresses a set of $N$ high-dimensional vectors into a small array of integer counters. This array is sufficient to estimate the kernel density for a large class of kernels. Our sketch is practical to implement and comes with strong theoretical guarantees. We evaluate our method on real-world high-dimensional datasets and show that our sketch achieves 10x better compression compared to competing methods.
Introduction
Kernel Density Estimation (KDE) is a fundamental tool for understanding data distributions, utilized in applications ranging from anomaly detection to clustering. However, KDE suffers from a significant scaling problem. To obtain an exact estimate, one traditionally needs to store every data point and compare a query against all of them—an $O(Nd)$ memory and computation cost. This becomes impossible for high-dimensional ($d$) streaming data with millions of points ($N$).
Existing workarounds have notable flaws. Sampling and merging methods still require storing actual high-dimensional vectors, which consumes significant memory. Coresets often require expensive $O(N^2)$ pre-processing, making them unsuitable for real-time streams. Furthermore, most streaming algorithms that perform well in low dimensions (2D or 3D) collapse under the "curse of dimensionality" common in modern machine learning datasets.
The RACE Algorithm
The Repeated Array-of-Counts Estimator (RACE) addresses these challenges by storing a 2D array of integer counters instead of raw data points. The algorithm operates through two primary phases: sketching and querying.
Sketching and Querying
- Sketching (The "Add" operation): When a new data point arrives from a stream, it is processed by $L$ independent Locality Sensitive Hashing (LSH) functions. Each hash function maps the high-dimensional vector to a specific "bucket" (an index in a row of the array). The algorithm simply increments the counter at that index. This process is $O(L)$ and independent of the total number of points $N$.
- Querying: To estimate the density at a new point $q$, the point is hashed using the same functions to identify the corresponding counters. The average (or median) of these counts provides a mathematically sound, unbiased estimate of the kernel density.
For kernels with infinite range, such as Gaussian or Laplacian, RACE employs a "rehashing trick" to map infinite hash values into a finite array, providing a biased but corrected estimator with tight error bounds. The sketch size is "sub-linear" because it depends on the desired accuracy ($\epsilon$) and data density rather than $N$ or $d$.
Comparative Analysis
RACE distinguishes itself from existing literature by its unique memory profile and operational constraints. Unlike methods that require storing representative vectors, RACE only maintains integer counts.
As shown in the table above, RACE provides a competitive memory bound of $O(\frac{1}{\epsilon^2} \frac{1}{KDE^2} \log \frac{1}{\delta})$. While other methods like Kernel Herding or Coresets may offer different dependencies, they often suffer from prohibitive $O(|D|^2)$ sketching costs or require matrix inversions that scale poorly with sketch size.
Experimental Evaluation
The authors evaluated RACE across several high-dimensional, real-world domains, including audio processing (Intervalgrams), web security (Webspam with 3.7 million features), and hyperspectral imaging.
Key findings include:
- 10x Better Compression: On most datasets, RACE achieved the same error rate as baseline methods (like Random Sampling) while using only 1/10th of the memory.
- Bandwidth Sensitivity: As the "bandwidth" ($\sigma$) of the kernel increases, the RACE sketch becomes even more efficient, requiring fewer non-zero counters to maintain accuracy.
- Theoretical Validation: Empirical results closely matched theoretical proofs, confirming that error decreases at a rate of $O(1/\sqrt{LK})$.
Key Insights and Future Work
RACE offers several architectural advantages beyond raw performance. Because the sketches are linear, they are "mergeable"; two RACE arrays from different streams can be added together to represent the combined data, making the algorithm ideal for distributed systems. Additionally, because it stores randomized hashes and counts rather than raw vectors, RACE provides an inherent privacy bonus, making it difficult to reconstruct original data points.
Future research directions include more aggressive memory optimizations, such as delta coding or sparse array formats, to further compress the integer counters. There is also potential for deeper formal analysis of the differential privacy guarantees provided by the randomized hashing mechanism.
Summary updated