# On the Use of Random Forest for Two-Sample Testing

arXiv: https://arxiv.org/abs/1903.06287 · HTML: https://mlsanity.com/paper/1903.06287/

## Key facts

- Cited by 13 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 14 Mar 2019.

## Built on by (most cited first, 13 of 13)

- [Sequential Predictive Two-Sample and Independence Testing](https://mlsanity.com/paper/2305.00143/) (2023)
- [AutoML Two-Sample Test](https://mlsanity.com/paper/2206.08843/) (2022)
- [Random Forests for Change Point Detection](https://mlsanity.com/paper/2205.04997/) (2022)
- [Test for non-negligible adverse shifts](https://mlsanity.com/paper/2107.02990/) (2021)
- [General Frameworks for Conditional Two-Sample Testing](https://mlsanity.com/paper/2410.16636/) (2024)
- [A fast and effective kernel two-sample test for large-scale data](https://mlsanity.com/paper/2110.03118/) (2021)
- [Non-parametric online market regime detection and regime clustering for multidimensional and path-dependent data structures](https://mlsanity.com/paper/2306.15835/) (2023)
- [Anchor-based Maximum Discrepancy for Relative Similarity Testing](https://mlsanity.com/paper/2510.10477/) (2025)
- [Detecting Performance Degradation under Data Shift in Pathology Vision-Language Model](https://mlsanity.com/paper/2601.00716/) (2026)
- [A framework for paired-sample hypothesis testing for high-dimensional data](https://mlsanity.com/paper/2309.16274/) (2023)
- [Are Two Datasets Close Enough With Statistical Significance? A Kernel Distributional Closeness Testing Approach](https://mlsanity.com/paper/2507.12843/) (2025)
- [A Family of Divergence Measures for Evaluating the Reconstruction Quality of Explainable Ensemble Trees](https://mlsanity.com/paper/2605.19618/) (2026)
- [From Imbalance to Evidence: Deep Nonparametric Testing for Complex Data under Severe Sample Imbalance](https://mlsanity.com/paper/2610.12946/) (2026)

## Abstract (arXiv)

Following the line of classification-based two-sample testing, tests based on the Random Forest classifier are proposed. The developed tests are easy to use, require almost no tuning, and are applicable for any distribution on ℝd. Furthermore, the built-in variable importance measure of the Random Forest gives potential insights into which variables make out the difference in distribution. An asymptotic power analysis for the proposed tests is developed. Finally, two real-world applications illustrate the usefulness of the introduced methodology. To simplify the use of the method, the R-package "hypoRF" is provided.
