Abstract
Standard Kernel Stein Discrepancy (KSD) tests often fail when applied to data on restricted domains or complex geometries. We introduce the Standardisation-function Kernel Stein Discrepancy (Sf-KSD), a unifying framework that incorporates an auxiliary "standardisation function" $g(x)$ into the Stein operator. This approach allows for the systematic design of powerful goodness-of-fit tests for truncated and compositional data. We demonstrate that Sf-KSD recovers existing specialized operators as special cases and provides a principled way to handle boundary conditions, significantly improving test power and error control in non-Euclidean settings.
Introduction
In machine learning and statistics, goodness-of-fit testing determines whether observed data follows a specific theoretical distribution. This task is particularly difficult for "unnormalised" distributions, where the normalization constant is unknown—a common scenario in Bayesian inference and deep generative modeling.
Kernel Stein Discrepancy (KSD) has emerged as a popular tool for these cases because it relies only on the score function (the derivative of the log-density), bypassing the need for the normalization constant. However, research has primarily focused on kernel choice, often treating the Stein operator as a fixed component. This paper argues that the Stein operator is a critical, tunable component that must be adapted to the data's geometry to ensure valid statistical testing.
The Sf-KSD Framework
The authors propose the Sf-KSD framework, which introduces a matrix-valued auxiliary function $g(x)$, termed the standardisation function, into the Stein operator. This framework serves two primary purposes:
- Unification: By selecting specific forms for $g(x)$, Sf-KSD mathematically recovers various specialized operators, such as the Martingale Stein operator for survival analysis and the Langevin-diffusion operator for Euclidean data.
- Optimality: Through the calculus of variations, the authors identify that the theoretically optimal $g(x)$ corresponds to the density ratio between the target and true data distributions, providing a "north star" for designing better functions.
Handling Bounded Domains
A significant challenge for standard KSD is data restricted to compact domains. Standard KSD assumes densities vanish at infinity; when data is truncated, this assumption is violated, leading to high false-positive rates (Type-I errors). The Bounded-Domain KSD (bd-KSD) uses $g(x)$ to ensure the operator respects domain boundaries by "forcing" the integration-by-parts remainder to zero.
Similarly, for compositional data—where components must sum to a constant—the data resides on a simplex manifold. Sf-KSD allows for valid goodness-of-fit tests on these constrained geometries where traditional methods often fail.
Experimental Evaluation
The Sf-KSD method was evaluated across synthetic and real-world datasets:
- Synthetic Tests: Experiments on truncated Gaussian distributions and Dirichlet distributions (simplex data) showed that bd-KSD maintains correct Type-I error rates (e.g., $\alpha = 0.01$) where standard KSD fails, often reaching a 100% error rate.
- Chicago Crime Dataset: The spatial distribution of robbery reports in 2020 was analyzed against Gaussian Mixture Models to test spatial fit.
- Aphyric Skye Lavas: This geochemical dataset of chemical proportions in lava samples served as a test for compositional data. bd-KSD successfully identified the inadequacy of a standard Gaussian kernel density estimate for this data, providing a significant p-value of 0.004.
Key Insights and Results
- Operator Flexibility: The Stein operator should be viewed as a tunable component optimized for data geometry rather than a fixed part of the machinery.
- Boundary Awareness: By choosing $g(x)$ such that it vanishes at the boundary, Sf-KSD eliminates the mathematical errors that typically cause standard KSD to fail on bounded domains.
- Superior Power: In comparative tests, bd-KSD achieved significantly higher test power (the ability to correctly reject false models) than standard Maximum Mean Discrepancy (MMD) and other KSD variants.
Conclusion
Sf-KSD provides a robust, unifying framework for Stein-based testing. While current implementations rely on heuristic choices for $g(x)$, the theoretical link to density ratios suggests that future work could involve "learning" the optimal standardisation function directly from data, potentially leading to fully automated, adaptive goodness-of-fit tests.
Summary updated