Skip to main content
QUICK REVIEW

[Paper Review] Fast Two-Sample Testing with Analytic Representations of Probability Measures

Kacper Chwialkowski, Aaditya Ramdas|arXiv (Cornell University)|Jun 15, 2015
Gaussian Processes and Bayesian InferenceComputer Science73 citations
TL;DR

This paper proposes two fast, consistent two-sample tests with linear time complexity by leveraging analytic representations of probability measures: smoothed empirical characteristic functions and analytic mean embeddings in a reproducing kernel Hilbert space. The tests achieve superior power-to-computation tradeoffs, outperforming both linear-time nonparametric tests and expensive quadratic-time methods like MMD, especially in high dimensions and for subtle distributional differences.

ABSTRACT

We propose a class of nonparametric two-sample tests with a cost linear in the sample size. Two tests are given, both based on an ensemble of distances between analytic functions representing each of the distributions. The first test uses smoothed empirical characteristic functions to represent the distributions, the second uses distribution embeddings in a reproducing kernel Hilbert space. Analyticity implies that differences in the distributions may be detected almost surely at a finite number of randomly chosen locations/frequencies. The new tests are consistent against a larger class of alternatives than the previous linear-time tests based on the (non-smoothed) empirical characteristic functions, while being much faster than the current state-of-the-art quadratic-time kernel-based or energy distance-based tests. Experiments on artificial benchmarks and on challenging real-world testing problems demonstrate that our tests give a better power/time tradeoff than competing approaches, and in some cases, better outright power than even the most expensive quadratic-time tests. This performance advantage is retained even in high dimensions, and in cases where the difference in distributions is not observable with low order statistics.

Motivation & Objective

  • To develop fast, consistent nonparametric two-sample tests with linear time complexity for large-scale data.
  • To overcome the limitations of previous linear-time tests based on non-smoothed characteristic functions, which lack consistency under general alternatives.
  • To enable consistent testing using only a single random evaluation point of analytic representations, reducing computational cost while preserving statistical power.
  • To improve the power/computation tradeoff compared to state-of-the-art quadratic-time tests like MMD and energy distance, particularly in high dimensions and for complex distributional differences.
  • To demonstrate robustness and scalability on real-world and synthetic benchmarks, including high-dimensional and low-signal-difference scenarios.

Proposed method

  • The first test uses smoothed empirical characteristic functions as analytic representations, where differences in distributions are detectable almost surely at a single random frequency.
  • The second test employs analytic mean embeddings in a reproducing kernel Hilbert space (RKHS), with distances computed at a single randomly selected point to ensure almost sure injectivity.
  • Both methods rely on the analyticity property, which ensures that differences in distributions are detectable at finite, randomly chosen locations with probability one.
  • The tests are constructed using empirical estimates of the analytic representations, enabling linear-time computation and constant memory usage.
  • Statistical significance is assessed via permutation testing, though the method’s efficiency allows for scalable application.
  • The approach generalizes previous work by ensuring consistency for all distributions with integrable characteristic functions and for all distributions via RKHS embeddings.

Experimental results

Research questions

  • RQ1Can two-sample testing be made both consistent and linear-time using analytic representations of probability measures?
  • RQ2Does using smoothed characteristic functions or analytic mean embeddings enable consistent detection of distribution differences with only a single evaluation point?
  • RQ3How does the power and computational efficiency of these tests compare to existing linear-time and quadratic-time methods in high-dimensional and complex data settings?
  • RQ4Can the proposed tests detect subtle distributional differences not visible in low-order statistics, such as in angular momentum or variance shifts?
  • RQ5Does the method maintain high power under noise contamination and in high-dimensional data with only minor differences in a single dimension?

Key findings

  • The Smoothed Characteristic Function (Smooth CF) test achieved significantly higher power than MMD on the Higgs boson dataset, even though MMD is quadratic-time and computationally expensive.
  • On the Higgs dataset, the Smooth CF test maintained high power up to 12,000 samples, while MMD could only be run up to 5,100 samples due to computational constraints.
  • On the amplitude-modulated music dataset with added noise, the Mean Embedding and Smooth CF tests were more robust than other methods, maintaining high power under moderate noise contamination.
  • In high-dimensional settings with only a single differing dimension, the Mean Embedding test outperformed others, especially for variance shifts, demonstrating strong performance in high-dimensional redundancy.
  • On the challenging Blobs dataset with small-scale distributional differences, MMD had the highest power but worst time/power tradeoff, while the proposed tests achieved the best tradeoff among linear-time methods.
  • The proposed tests achieved consistent performance across all benchmarks, including cases where differences were not detectable via low-order statistics, confirming their sensitivity to complex distributional shifts.

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.