Skip to main content
QUICK REVIEW

[Paper Review] A Witness Two-Sample Test

Jonas M. Kübler, Wittawat Jitkrittum|arXiv (Cornell University)|Feb 10, 2021
Machine Learning in Materials ScienceMaterials Science2 citations
TL;DR

This paper proposes the Witness Two-Sample Test (WiTS), a novel two-stage nonparametric hypothesis test that learns an optimal one-dimensional witness function from training data to maximize test power, then uses permutation-based p-values for inference. The method outperforms MMD and classification-based tests on synthetic and real-world data, including the Higgs boson dataset, by jointly optimizing the witness function and leveraging all data efficiently without overfitting.

ABSTRACT

The Maximum Mean Discrepancy (MMD) has been the state-of-the-art nonparametric test for tackling the two-sample problem. Its statistic is given by the difference in expectations of the witness function, a real-valued function defined as a weighted sum of kernel evaluations on a set of basis points. Typically the kernel is optimized on a training set, and hypothesis testing is performed on a separate test set to avoid overfitting (i.e., control type-I error). That is, the test set is used to simultaneously estimate the expectations and define the basis points, while the training set only serves to select the kernel and is discarded. In this work, we propose to use the training data to also define the weights and the basis points for better data efficiency. We show that 1) the new test is consistent and has a well-controlled type-I error; 2) the optimal witness function is given by a precision-weighted mean in the reproducing kernel Hilbert space associated with the kernel; and 3) the test power of the proposed test is comparable or exceeds that of the MMD and other modern tests, as verified empirically on challenging synthetic and real problems (e.g., Higgs data).

Motivation & Objective

  • To address the limitation of existing MMD-based two-sample tests that discard training data after kernel selection, reducing data efficiency.
  • To improve test power by learning a problem-specific witness function rather than relying on pre-specified or optimized kernels.
  • To provide a theoretically grounded, consistent test with well-controlled type-I error and asymptotic normality of the test statistic.
  • To enable the use of standard machine learning techniques for function class selection and hyperparameter tuning in two-sample testing.
  • To demonstrate empirically that learning a witness function can outperform learning a kernel in terms of test power on challenging benchmarks.

Proposed method

  • The WiTS test learns a witness function by maximizing a test-power criterion on a training set, using a precision-weighted mean in the reproducing kernel Hilbert space (RKHS).
  • The witness function is defined as the solution to a regularized optimization problem that balances fit and smoothness, ensuring generalization.
  • The test statistic is the difference in sample means of the witness function evaluated on two test sets, which is asymptotically normal under both null and alternative hypotheses.
  • The null distribution is approximated via permutation testing, ensuring valid type-I error control without requiring independent test sets.
  • The method is extended to deep kernel MMD by learning the witness function after kernel optimization, enabling end-to-end training of the witness.
  • The framework is general and can be applied with any function class, not limited to kernels, enabling integration with classification and regression tools.

Experimental results

Research questions

  • RQ1Can learning a one-dimensional witness function from training data improve test power compared to standard MMD with kernel optimization?
  • RQ2Does a witness-based two-sample test maintain well-controlled type-I error while achieving higher statistical power?
  • RQ3How does the WiTS test compare to MMD with optimized kernels and classification-based two-sample tests on real-world and synthetic data?
  • RQ4Can the witness function be learned efficiently and scalably, especially in high-dimensional or large-scale settings?
  • RQ5Is the WiTS framework compatible with modern deep kernel methods and other function classes?

Key findings

  • The WiTS test achieves higher statistical power than MMD with optimized deep kernels (opt-mmd-witness) on the Higgs boson dataset, especially at moderate sample sizes.
  • On the synthetic Blobs dataset, WiTS methods (e.g., opt-mmd-witness) outperform opt-mmd-boot and other benchmarks across various data splitting ratios.
  • The witness-based approach consistently outperforms baseline MMD and classification-based tests (e.g., C2ST) on both synthetic and real-world benchmarks, including the Higgs dataset with over 1,000 samples per class.
  • The method maintains well-controlled type-I error rates through permutation-based null distribution estimation, even when the witness is learned from training data.
  • The optimal witness function is mathematically shown to be a precision-weighted mean in the RKHS, providing a principled learning objective.
  • The framework is scalable: using Nyström approximation with 500 centers, kfda-witness achieves high performance on the Higgs dataset with reduced computational cost.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.