Abstract
Two-sample tests evaluate whether two samples are realizations of the same distribution (the null hypothesis) or two different distributions (the alternative hypothesis). We consider a new setting for this problem where sample features are easily measured whereas sample labels are unknown and costly to obtain. Accordingly, we devise a three-stage framework in service of performing an effective two-sample test with only a small number of sample label queries: first, a classifier is trained with samples uniformly labeled to model the posterior probabilities of the labels; second, a novel query scheme dubbed bimodal query is used to query labels of samples from both classes, and last, the classical Friedman-Rafsky (FR) two-sample test is performed on the queried samples. Theoretical analysis and extensive experiments performed on several datasets demonstrate that the proposed test controls the Type I error and has decreased Type II error relative to uniform querying and certainty-based querying.
Introduction
Two-sample testing is a fundamental statistical task: given two sets of data, do they come from the same distribution or different ones? Traditional methods assume that group labels are already known for all samples. However, in many modern applications—such as validating digital biomarkers for Alzheimer’s disease—collecting raw data is inexpensive, but obtaining the "ground truth" label (e.g., an expensive PET scan) is very costly.
This paper addresses the challenge of performing a reliable hypothesis test using only a tiny fraction of possible labels. Standard random sampling often fails in these scenarios because it does not prioritize the most informative data points, leading to a "weak" test that may fail to detect real differences between groups.
The Three-Stage Framework
To maximize label efficiency, we propose a three-stage framework:
- Model: A small initial batch of data is labeled uniformly at random to train a probabilistic classifier. This classifier learns to estimate the posterior probability—the likelihood that a given sample belongs to a specific class.
- Bimodal Query: This is the core innovation. Instead of querying labels for "uncertain" points near the decision boundary (a common tactic in active learning), the algorithm queries points that the classifier is most certain about for both classes. This "bimodal" approach intentionally selects samples that are most likely to represent the distinct "modes" of the two distributions.
- Test: Finally, a classical graph-based test—the Friedman-Rafsky (FR) test—is performed on the selectively labeled samples. The FR test works by building a Minimum Spanning Tree (MST) across all points and counting "cut edges" (edges connecting points from different classes). Fewer cut edges than expected suggests the distributions are different.
Experimental Results
The framework was evaluated on synthetic datasets, the MNIST handwritten digits dataset, and the Alzheimer’s Disease Neuroimaging Initiative (ADNI) dataset.
Certainty vs. Uncertainty
A striking insight from our research is that for hypothesis testing, one requires the opposite of what is typically sought in active learning. While active learning seeks uncertain points to refine a decision boundary, our test seeks certain points to maximize the observable separation between distributions, thereby increasing the statistical "power" of the test.
Performance and Robustness
The bimodal query consistently outperformed passive (random) sampling and other active strategies (like uncertainty querying) across all datasets. As shown in the results for MNIST and ADNI, the bimodal approach reaches a near-zero Type II error (correctly rejecting the null hypothesis) with far fewer labels than other methods.
Furthermore, the bimodal query helps overcome the "curse of dimensionality." Traditional graph-based tests often lose power as the number of features increases. We demonstrate that the bimodal query makes the test's convergence rate independent of the feature dimension, making it exceptionally robust for high-dimensional data.
Conclusion
By selectively biasing the sample toward the most certain points of each class, our bimodal query strategy significantly increases the power of two-sample tests under a strict label budget. Despite this bias, the use of a permutation test ensures that the Type I error (false positive rate) remains strictly controlled. This framework provides a robust solution for distributional shift detection in high-stakes, high-cost labeling environments.
Summary updated