Large-scale kernel methods for independence testing

Qinyi Zhang, Sarah Filippi, Arthur Gretton, Dino SejdinovicStat. Comput 2018 · DOI

Abstract

Kernel-based independence tests, such as the Hilbert-Schmidt Independence Criterion (HSIC), provide a powerful framework for detecting non-linear dependencies. However, their quadratic computational complexity $O(m^2)$ limits their application to large datasets. This paper evaluates three linear-time approximation strategies—Block-based estimators, Nyström approximations, and Random Fourier Features (RFF)—to enable independence testing on millions of samples. We provide a rigorous statistical framework for these approximations and demonstrate their effectiveness on both synthetic benchmarks and the Million Song Dataset.

Introduction

In statistical analysis, determining whether two random variables $X$ and $Y$ are independent is a fundamental task. While classical methods like Pearson’s correlation coefficient are effective for identifying linear relationships, they often fail to detect complex, non-linear patterns such as sinusoidal or circular dependencies. Kernel methods, particularly the Hilbert-Schmidt Independence Criterion (HSIC), address this by mapping data into a high-dimensional Reproducing Kernel Hilbert Space (RKHS). In this space, any form of dependence can be characterized as a linear covariance, allowing for a non-parametric test of independence.

Despite its theoretical elegance, HSIC faces a significant practical hurdle: computational cost. Standard estimators for HSIC scale quadratically ($O(m^2)$) with the number of samples $m$. In the era of Big Data, where datasets frequently exceed millions of observations, this "quadratic wall" renders standard HSIC unusable. This paper explores and formalizes three approximation techniques that reduce the computational burden to linear time, facilitating large-scale independence testing.

Linear-Time Approximation Methods

The authors focus on three primary strategies to approximate the HSIC and, crucially, to perform hypothesis testing (calculating p-values) efficiently.

1. Block-based Estimators

The block-based approach partitions the dataset into $m/B$ blocks of size $B$. The HSIC is calculated independently for each block, and the final test statistic is the average of these block-wise estimates. This method leverages the Central Limit Theorem; as the number of blocks increases, the null distribution of the averaged statistic converges to a Gaussian distribution. This simplifies the calculation of p-values significantly compared to the complex, heavy-tailed distributions encountered in standard HSIC.

2. Nyström Low-Rank Approximation

The Nyström method approximates the kernel matrix by selecting a small subset of $n$ "inducing variables" or landmark points. These points are used to represent the geometry of the entire dataset, reducing the complexity to $O(n^2 m)$. This approach is highly versatile as it does not require the kernel to be shift-invariant, making it compatible with a wide range of kernels, including the Brownian kernel.

3. Random Fourier Features (RFF)

For shift-invariant kernels like the Gaussian Radial Basis Function (RBF), the RFF method maps the data into a finite-dimensional random feature space. In this transformed space, the independence test is reduced to a simple linear covariance check. This method is exceptionally efficient for extremely large datasets, scaling linearly with both the number of samples and the number of random features.

Experimental Evaluation

The proposed methods were evaluated using both synthetic benchmarks and real-world data to assess their statistical power and computational efficiency.

Synthetic Benchmarks

The authors tested the methods on several models, including linear dependence, highly non-linear "Sine" dependence, and a "Challenging" low signal-to-noise ratio model. In the Sine experiment, the approximate methods achieved a statistical power of 1.0 (perfect detection) while being several orders of magnitude faster than the quadratic-time HSIC. Most notably, the RFF method successfully performed independence tests on a dataset of 10 million samples, a task that is computationally impossible for standard HSIC on a single machine.

Real-World Application: Million Song Dataset

The methods were applied to a subset of the Million Song Dataset (MSD) containing over 500,000 songs. The objective was to detect the dependence between audio timbre features and the song's release year. The Nyström spectral approach demonstrated the highest statistical power in this context, followed closely by RFF. While the Block-based method was the least powerful, its simplicity and ease of implementation make it a viable candidate for many practical applications.

Discussion and Conclusion

The transition from quadratic to linear-time HSIC involves a trade-off between statistical power and computational speed. While approximations may lose some power for a fixed sample size compared to the exact test, their efficiency allows practitioners to process significantly larger datasets, which more than compensates for the loss.

Key takeaways include:

  • RFF for Scale: RFF is the preferred method for massive datasets (e.g., $10^7$ samples) due to its extreme efficiency.
  • Nyström for Flexibility: Nyström is ideal when using non-shift-invariant kernels or when high precision is required on moderately large datasets.
  • Block-based for Simplicity: The Gaussian null distribution of the block-based estimator provides a straightforward path for p-value calculation.

Future work remains in optimizing the selection of inducing points for Nyström and extending these fast tests to non-IID data, such as time-series.

Summary updated

BibTeX
@article{zhang2018large,
  author = {Qinyi Zhang and Sarah Filippi and Arthur Gretton and Dino Sejdinovic},
  title = {{Large-scale kernel methods for independence testing}},
  journal = {Stat. Comput.},
  year = {2018},
  doi = {10.1007/s11222-016-9721-7},
}
Figure