Counterfactual Explanations for Deep Two-Sample Testing
Not on the map. Why?
Abstract (arXiv)
Two-sample testing is a fundamental tool for detecting distributional differences across scientific domains, but classical tests (including kernel-based tests) can be ineffective on high-dimensional structured data such as images. Recent deep two-sample tests improve sensitivity in these settings by learning informative representations, yet they provide limited insight into which data features drive rejection of the null hypothesis H0. To address this issue, we propose a counterfactual explanation framework for deep two-sample testing that generates sample-level edits moving observations from a source group toward a target group while explicitly reducing the discrepancy measured by the test. Our method combines a diffusion autoencoder with a pretrained deep two-sample test model and optimizes a maximum mean discrepancy (MMD) objective in the test model's representation space to produce plausible counterfactuals. We quantify distribution-level effects through changes in the test statistic and the resulting two-sample p-values. We evaluate the method on synthetic 2D shape datasets and two MRI cohorts. Across both settings, the counterfactual transformations consistently increase p-values relative to the original samples, indicating that the edited source set becomes statistically closer to the target distribution under the test. We measure minimality using LPIPS to ensure the counterfactuals remain close to the original samples. The resulting edits provide interpretable evidence of the features associated with the detected group differences. On MRI, the localized changes are consistent with known anatomical differences between cohorts.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 15 of its 26 references that are in the map. First posted on arXiv 29 May 2026.
Builds on
15 of 26 references.
References · 15
- 2020Denoising Diffusion Probabilistic Modelscited by 20,851
- 2021High-Resolution Image Synthesis with Latent Diffusion Modelscited by 18,694
- 2018The Unreasonable Effectiveness of Deep Features as a Perceptual Metriccited by 11,029
- 2016Grad-CAM: Visual Explanations from Deep Networks via Gradient-based Localizationcited by 6,690
- 2021Improved Denoising Diffusion Probabilistic Modelscited by 3,736
- 2017Axiomatic Attribution for Deep Networkscited by 3,350
- 2017Learning Important Features Through Propagating Activation Differencescited by 1,454
- 2014Striving for Simplicity: The All Convolutional Netcited by 983
- 2021Diffusion Autoencoders: Toward a Meaningful and Decodable Representationcited by 447
- 2016Revisiting Classifier Two-Sample Testscited by 258
- 2020Learning Deep Kernels for Non-Parametric Two-Sample Testscited by 129
- 2019Two-sample Testing Using Deep Learningcited by 26
3 more
- 2024Global Counterfactual Directionscited by 15
- 2021Benchmarks, Algorithms, and Metrics for Hierarchical Disentanglementcited by 12
- 2024A Unified Data Representation Learning for Non-parametric Two-sample Testingcited by 5
Built on by
Not cited yet.