Unified Unbiased Variance Estimation for MMD: Robust Finite-Sample Performance with Imbalanced Data and Exact Acceleration under Null and Alternative Hypotheses
Shijie Zhong, Jiangfeng Fu, Yikun Yang
TL;DR
This work provides a unified, finite-sample variance characterization for the Maximum Mean Discrepancy (MMD) that holds under both null and alternative hypotheses and across balanced or imbalanced sample configurations, by leveraging the Hoeffding decomposition of U-statistics. It derives a practical, unbiased estimator of the MMD variance that decomposes into first-order and second-order components, with explicit, numerically stable estimators that handle independence between samples. A key contribution is an exact, near-linear-time acceleration for univariate MMD with the Laplace kernel (euMMD), achieved via prefix-suffix recurrences and sorted prefix sums, reducing complexity from $O(n^2)$ to $O(n \, \log n)$. The proposed framework improves robustness to sample imbalance and provides a transparent decomposition of variance, including a tractable second-order term, with strong empirical validation showing accurate variance estimation and substantial computational gains for large-scale data.
Abstract
The maximum mean discrepancy (MMD) is a kernel-based nonparametric statistic for two-sample testing, whose inferential accuracy depends critically on variance characterization. Existing work provides various finite-sample estimators of the MMD variance, often differing under the null and alternative hypotheses and across balanced or imbalanced sampling schemes. In this paper, we study the variance of the MMD statistic through its U-statistic representation and Hoeffding decomposition, and establish a unified finite-sample characterization covering different hypotheses and sample configurations. Building on this analysis, we propose an exact acceleration method for the univariate case under the Laplacian kernel, which reduces the overall computational complexity from $\mathcal O(n^2)$ to $\mathcal O(n \log n)$.
