[Paper Review] Two-sample Testing Using Deep Learning
This paper proposes a deep learning-based two-sample test that leverages representations from pre-trained neural networks to improve statistical power. By mapping data to a hidden layer and applying asymptotic location tests, the method achieves up to 35 percentage point reductions in type-2 error compared to state-of-the-art methods like MMD and C2ST, while maintaining proper type-1 error control and enabling linear-time computation.
We propose a two-sample testing procedure based on learned deep neural network representations. To this end, we define two test statistics that perform an asymptotic location test on data samples mapped onto a hidden layer. The tests are consistent and asymptotically control the type-1 error rate. Their test statistics can be evaluated in linear time (in the sample size). Suitable data representations are obtained in a data-driven way, by solving a supervised or unsupervised transfer-learning task on an auxiliary (potentially distinct) data set. If no auxiliary data is available, we split the data into two chunks: one for learning representations and one for computing the test statistic. In experiments on audio samples, natural images and three-dimensional neuroimaging data our tests yield significant decreases in type-2 error rate (up to 35 percentage points) compared to state-of-the-art two-sample tests such as kernel-methods and classifier two-sample tests.
Motivation & Objective
- To address the limitations of traditional two-sample tests in handling complex, structured data such as images, audio, and neuroimaging.
- To improve statistical power by leveraging deep neural network representations learned from auxiliary data or data splits.
- To develop a test that maintains asymptotic type-1 error control and achieves consistency (vanishing type-2 error) under mild assumptions.
- To enable efficient, linear-time evaluation of test statistics without relying on resampling or kernel choice sensitivity.
- To provide a robust, data-driven alternative to kernel methods and classifier-based tests in high-dimensional and complex data settings.
Proposed method
- The method uses a pre-trained deep neural network—trained on an auxiliary dataset or via data splitting—to extract representations from input samples.
- Two test statistics are proposed: one based on Maximum Mean Discrepancy (MMD) and another on Fisher discriminant analysis, both applied to the hidden-layer representations.
- The test statistics are asymptotically distributed under the null hypothesis, enabling p-value computation via standard normal approximation.
- The approach allows for linear-time evaluation of the test statistics, scaling efficiently with sample size.
- Transfer learning is used to obtain robust, generalizable representations, even when the auxiliary data differs from the test data.
- When no auxiliary data is available, the method splits the data into two parts: one for representation learning and one for test statistic computation.
Experimental results
Research questions
- RQ1Can deep neural network representations improve the power of two-sample tests on complex data such as images, audio, and 3D neuroimaging?
- RQ2Does a deep learning-based two-sample test maintain proper type-1 error control while achieving consistency?
- RQ3How does the proposed method compare to state-of-the-art methods like MMD and classifier two-sample tests in terms of type-2 error reduction?
- RQ4Can the method achieve linear-time computation while maintaining statistical robustness?
- RQ5How sensitive is the method to hyperparameters, transfer learning choice, or approximate training?
Key findings
- The proposed deep two-sample test reduces type-2 error by up to 35 percentage points compared to state-of-the-art methods on audio, image, and neuroimaging data.
- The method asymptotically controls the type-1 error rate, ensuring valid statistical inference under the null hypothesis.
- The test is consistent, meaning the type-2 error rate converges to zero as sample size increases.
- The test statistics can be computed in linear time, making the method scalable to large datasets.
- The method outperforms both kernel-based MMD and classifier two-sample tests across diverse data modalities, including 3D MRI scans and facial expression data.
- Robustness to transfer learning and approximate training is demonstrated, supporting practical deployment with pre-trained models.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.