TL;DR
The paper introduces KSDAgg, a novel goodness-of-fit test that aggregates multiple Kernel Stein Discrepancy (KSD) tests using different kernels. By avoiding the common pitfalls of arbitrary heuristics and power-sapping data splitting, KSDAgg achieves minimax optimal detection rates and consistently outperforms state-of-the-art methods in both synthetic and high-dimensional real-world scenarios.
What Problem Does This Paper Address?
In nonparametric hypothesis testing, a "goodness-of-fit" test asks a fundamental question: Does this set of observed data points actually come from this specific probability model?
The Kernel Stein Discrepancy (KSD) is a popular tool for this because it only requires the "score function" (the gradient of the log-density) of the model. This is a huge advantage for complex models like Energy-Based Models or Normalizing Flows, where the normalization constant is unknown.
However, KSD tests have a "kernel selection" problem. The test's sensitivity (power) depends heavily on the choice of kernel and its hyperparameters (like the bandwidth of a Gaussian kernel). Currently, researchers usually handle this in two ways:
- Heuristics: Using the "median trick" to set bandwidth, which is arbitrary and often suboptimal.
- Data Splitting: Using half the data to "learn" the best kernel and the other half to perform the test. This is wasteful because reducing the sample size directly reduces the test's power.
Methods
The authors propose KSDAgg, the first aggregation procedure for KSD tests. Instead of picking one "best" kernel, they run a collection of tests over a range of kernels and bandwidths.
Key technical components include:
- Aggregation Strategy: The test rejects the null hypothesis if any of the individual tests in the collection reject it.
- Level Correction ($u_\alpha$): To prevent the "multiple comparisons" problem (where running many tests increases false positives), the authors use a sophisticated weighting and correction procedure. This is more powerful than a simple Bonferroni correction because it accounts for the correlation between tests using different kernels.
- Bootstrap Estimators: Since the null distribution of the KSD statistic is complex, they use either a parametric bootstrap (sampling from the model) or a wild bootstrap (using Rademacher variables) to estimate test thresholds.
- Theoretical Guarantees: They prove that KSDAgg achieves the "minimax optimal" separation rate over Sobolev balls (a class of smooth functions) up to a tiny iterated logarithmic factor. Essentially, the test is as sensitive as it can possibly be without knowing the underlying smoothness of the data distribution in advance.
Datasets
The authors evaluated KSDAgg against several baselines (median heuristic, data splitting, and a "best-case" extra-data test) using:
- Gamma Distribution: A simple 1D synthetic benchmark to test sensitivity to shape parameters.
- Gaussian-Bernoulli Restricted Boltzmann Machine (RBM): A 50-dimensional graphical model where the score function is known but the density is intractable.
- MNIST Normalizing Flow: A high-dimensional ($d=784$) experiment. They used a pre-trained generative model (RealNVP/Glow) and tested whether the model could distinguish between actual MNIST digits and samples generated by the flow.
Key Insights and Ideas
- Adaptivity is Free: KSDAgg is "adaptive," meaning it automatically finds the right scale to detect differences between the model and the data. The "price" for this adaptivity is only a logarithmic term in the theoretical power bound.
- Efficiency in High Dimensions: In the MNIST experiment, standard KSD tests failed to reach the "asymptotic regime" (where their theoretical properties kick in) at sample sizes below 500. KSDAgg, however, maintained high power even with limited data.
- No More Data Splitting: The results show that using all the data for an aggregated test is almost always better than using half the data to pick a "perfect" kernel.
- Interpretability: When KSDAgg rejects a model, you can look at which specific kernels in the collection triggered the rejection, providing a hint about the scale or nature of the discrepancy.
Key Results
- Superior Power: Across all experiments, KSDAgg matched or exceeded the power of the "median heuristic" and "data splitting" methods.
- Matching the "Oracle": In many cases, KSDAgg performed as well as a hypothetical test that was given extra data just to pick the optimal kernel.
- Robustness: The "KSDAGG⋆" variant (a parameter-free version recommended for practitioners) proved robust across different types of data and dimensions without needing manual tuning.
Limitations and Future Work
- Computational Complexity: Running multiple tests is naturally more expensive than running one. While the authors optimized this (e.g., computing the pairwise distance matrix only once), the complexity remains $O(|K| \cdot B \cdot N^2)$, where $|K|$ is the number of kernels and $B$ is the number of bootstrap samples.
- Quadratic Scaling: Like most KSD tests, this scales quadratically with the number of samples ($N^2$). The authors suggest that extending this aggregation to linear-time KSD tests (which use a different estimator) is a promising but challenging future direction.
- Restricted Sobolev Balls: The minimax optimality proof relies on a "restricted" Sobolev ball assumption (related to how densities differ at low frequencies). Proving this for unrestricted cases remains an open mathematical problem.
For those interested in implementation, the authors have provided their code at github.com/antoninschrab/ksdagg-paper.
Summary updated