Sequential Kernelized Independence Testing

Aleksandr Podkopaev, Patrick Blöbaum, Shiva Prasad Kasiviswanathan, Aaditya Ramdas

TL;DR

This paper introduces Sequential Kernelized Independence Testing (SKIT), a framework for testing whether two data streams are independent while monitoring them in real-time. By framing the statistical test as a "betting game," the authors create a procedure that can stop data collection early when evidence is strong, remains valid even if the data distribution drifts over time, and avoids the high computational cost of traditional permutation tests.

The Problem with Batch Testing

In classical statistics, independence testing is usually a "batch" process: you decide on a sample size (say, 1,000 observations), collect the data, and run a test. However, in the real world, data often arrives in a continuous stream. Practitioners naturally want to "peek" at the results and stop early if the evidence is clear, or keep going if it is ambiguous.

Traditional batch tests fail in streaming scenarios for two primary reasons:

  1. Optional Stopping: If you repeatedly run a batch test as new data arrives, you will eventually find a "significant" result just by chance, leading to a massive inflation of false positives (Type I error).
  2. Distribution Drift: Most tests assume data is independent and identically distributed (i.i.d.). If the underlying distribution changes over time (e.g., due to sensor drift or seasonal changes), standard tests can produce spurious correlations.

Methods: Testing by Betting

The authors overcome these limitations using the "testing by betting" framework. Imagine a game where you start with $1. At each time step, you bet a portion of your wealth on the hypothesis that the variables are dependent.

  • If the null hypothesis (independence) is true, your wealth is a "nonnegative martingale"—on average, you won't make money.
  • If the variables are actually dependent, your wealth should grow exponentially.
  • The Stopping Rule: You reject the null hypothesis the moment your wealth exceeds $1/\alpha$ (e.g., $20 if your significance level $\alpha$ is 0.05).

To design these bets, the authors use kernelized dependence measures:

  • HSIC (Hilbert-Schmidt Independence Criterion): A popular tool that uses kernels to detect complex, non-linear dependencies.
  • COCO and KCC: Alternative measures based on constrained covariance and canonical correlation.

They also introduce symmetry-based betting to handle cases where kernels are unbounded (like a simple linear correlation), making the test more robust.

Key Insights and Ideas

  • Robustness to Drift: A major advantage of SKIT is that these tests remain valid even if the marginal distributions of $X$ or $Y$ change over time, provided they don't both change simultaneously in a way that perfectly mimics dependence.
  • No Permutations Needed: Batch kernel tests usually require hundreds of computationally expensive "permutations" (shuffling the data) to determine a p-value. SKIT avoids this entirely, making it highly feasible for large-scale streaming applications.
  • Efficiency via Witness Functions: The "bet" at each step is guided by a "witness function" estimated from previous data. This function essentially points to the specific type of dependence the test should look for next.
  • Adaptive Complexity: The test naturally stops early for "easy" tasks (strong dependence) and takes longer for "hard" ones, optimizing the use of data resources.

Key Results

Superior Power and Early Stopping

SKIT significantly outperforms batch tests that use naive Bonferroni corrections for multiple testing. It also beats methods that try to reduce independence testing to a simpler "two-sample" test.

Rejection rate comparison showing SKIT's superior power over batch and sequential MMD tests.

As dependence strength increases, SKIT not only reliably rejects the null hypothesis but does so while consuming only a fraction of the available sample budget. The framework's various kernelized measures (HSIC, COCO, KCC) all demonstrate this efficient early-stopping behavior on synthetic models.

Performance of HSIC, COCO, and KCC on a Gaussian model, illustrating high rejection rates and reduced sample budgets.

Real-World Utility

The authors evaluated SKIT on a mix of high-dimensional real-world data:

  • Weather Data: On daily average temperatures from 2017–2022, SKIT successfully rejected the independence null for geographically close cities (like London and Amsterdam) while correctly failing to reject it for distant ones, confirming it can pick up on shared regional climate fluctuations.
  • MNIST: Testing independence between pairs of handwritten digits, the test reached a power of 1.0 (perfect detection of dependence) after processing only about 500 pairs of images.

Limitations and Future Work

  • Kernel Selection: Like all kernel methods, performance depends heavily on choosing the right kernel and hyperparameters (e.g., the "bandwidth"). While the authors use a standard "median heuristic," more automated kernel selection for sequential settings remains an open area.
  • Computational Scaling: While more efficient than permutation tests, calculating the witness functions for COCO and KCC can become slow as data grows. The authors suggest using Incomplete Cholesky Decompositions to keep the math fast, though this adds a layer of approximation.
  • Conditional Independence: This paper focuses on simple independence ($X \perp Y$). Extending this robust betting framework to conditional independence ($X \perp Y \mid Z$) is a logical and highly anticipated next step for causal discovery.

Summary updated

BibTeX
@inproceedings{podkopaev2023sequential,
  author = {Aleksandr Podkopaev and Patrick Blöbaum and Shiva Prasad Kasiviswanathan and Aaditya Ramdas},
  title = {{Sequential Kernelized Independence Testing}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=WiBn3GFN1f},
}
Figure