Abstract
We derive a new discrepancy statistic for measuring differences between two probability distributions based on combining Stein's identity with the reproducing kernel Hilbert space theory. We apply our result to test how well a probabilistic model fits a set of observations, and derive a new class of powerful goodness-of-fit tests that are widely applicable for complex and high dimensional distributions, even for those with computationally intractable normalization constants. Both theoretical and empirical properties of our methods are studied thoroughly.
Introduction
Goodness-of-fit testing addresses the fundamental statistical question: "Does a given set of observations originate from a specific probability distribution?" While classical methods like the $\chi^2$ or Kolmogorov-Smirnov tests are effective for simple, low-dimensional distributions, they struggle with the complex models prevalent in modern machine learning, such as Deep Generative Models or Markov Random Fields.
A primary obstacle in modern modeling is the intractable normalization constant. Many models define a density $q(x) = \tilde{q}(x)/Z$, where the partition function $Z$ is computationally expensive or impossible to calculate. Since traditional tests rely on the full density or cumulative distribution, they become inapplicable when $Z$ is unknown.
Methodology: Kernelized Stein Discrepancy (KSD)
We propose the Kernelized Stein Discrepancy (KSD), a "likelihood-free" approach that bypasses the need for normalization constants. KSD is built upon two theoretical pillars:
- Stein’s Identity: For a distribution $q$, the Stein operator applied to a function and averaged over $q$ is zero. This operator depends only on the score function $\nabla_x \log q(x)$. Because $\log(q) = \log(\tilde{q}) - \log(Z)$, the derivative $\nabla_x \log q(x)$ eliminates $Z$, allowing for computation using only the unnormalized density.
- Reproducing Kernel Hilbert Spaces (RKHS): By leveraging RKHS theory, we can analytically identify the "worst-case" function that maximizes the deviation from Stein's identity. Using kernels such as the RBF/Gaussian kernel, the discrepancy can be expressed in a closed-form, computable statistic.
KSD is estimated from data using a U-statistic (KSD-U), providing an unbiased measure of discrepancy. Statistical significance is determined via a bootstrap method to simulate the null distribution and derive p-values.
Key Insights
- The Score Function as a Sufficient Statistic: Testing model fit only requires knowing the gradient of the log-density—the "direction" the model expects data to move—rather than the absolute probability.
- Eliminating MCMC Dependencies: Unlike methods that compare data to samples drawn via Markov Chain Monte Carlo (MCMC), KSD is analytic. This avoids the biases and slow convergence issues associated with MCMC mixing.
- Theoretical Unification: KSD can be viewed as a kernelized version of the Fisher Divergence, bridging classical information geometry with modern kernel methods.
Empirical Evaluation and Results
The performance of KSD was evaluated on synthetic benchmarks, including 1D Gaussian Mixture Models and high-dimensional Gaussian-Bernoulli Restricted Boltzmann Machines (RBMs).
As shown in the experimental results, KSD-U demonstrates significant advantages:
- Classical Comparison: In 1D settings, KSD-U performs comparably to or better than traditional tests like Kolmogorov-Smirnov.
- High-Dimensional Robustness: On RBM tasks, KSD-U significantly outperforms MMD-MCMC. While MMD-MCMC is sensitive to the quality of MCMC samples, KSD remains robust as it does not require sampling from the model.
- Computational Trade-offs: While KSD-U offers high power at $O(n^2)$ complexity, a "Linear KSD" variant provides $O(n)$ efficiency at the cost of requiring more data to achieve similar statistical power.
Conclusion and Future Work
KSD provides a powerful framework for goodness-of-fit testing in high-dimensional, unnormalized models. Future research directions include developing more principled methods for kernel selection beyond the "median trick" heuristic and extending the framework from simple hypothesis testing to composite testing (fitting a class of models).
Summary updated