A Unified Data Representation Learning for Non-parametric Two-sample Testing
Xunye Tian, Liuhua Peng, Zhijian Zhou, Mingming Gong, Arthur Gretton, Feng Liu
TL;DR
The paper tackles non-parametric two-sample testing by leveraging unlabelled data to learn representations that preserve Type-I error while boosting power. It proposes RL-TST, a two-phase framework that first learns intrinsic, manifold-aware representations on the full dataset and then trains discriminative representations for testing, enabling stronger test statistics via classifier-based or deep-kernel approaches with permutation testing. Empirically, RL-TST variants consistently outperform strong baselines such as C2ST, C2ST-L, MMD-D, and MMD-FUSE on HDGM benchmarks as well as MNIST and ImageNet–Fake setups, while controlling error rates. The work also analyzes why standard semi-supervised learning methods often fail in testing contexts and argues that the two-phase RL-TST approach better exploits unlabelled data for discriminative testing, offering a scalable and effective direction for future research in high-dimensional two-sample problems.
Abstract
Learning effective data representations has been crucial in non-parametric two-sample testing. Common approaches will first split data into training and test sets and then learn data representations purely on the training set. However, recent theoretical studies have shown that, as long as the sample indexes are not used during the learning process, the whole data can be used to learn data representations, meanwhile ensuring control of Type-I errors. The above fact motivates us to use the test set (but without sample indexes) to facilitate the data representation learning in the testing. To this end, we propose a representation-learning two-sample testing (RL-TST) framework. RL-TST first performs purely self-supervised representation learning on the entire dataset to capture inherent representations (IRs) that reflect the underlying data manifold. A discriminative model is then trained on these IRs to learn discriminative representations (DRs), enabling the framework to leverage both the rich structural information from IRs and the discriminative power of DRs. Extensive experiments demonstrate that RL-TST outperforms representative approaches by simultaneously using data manifold information in the test set and enhancing test power via finding the DRs with the training set.
