arf: Adversarial Random Forests

Marvin N. Wright, David Watson, Kristin Blesch, Jan KaparOpenalex Unknown 2022 · OpenAlex

Abstract

Adversarial random forests (ARFs) recursively partition data into fully factorized leaves, where features are jointly independent. The procedure is iterative, with alternating rounds of generation and discrimination. Data becomes increasingly realistic at each round, until original and synthetic samples can no longer be reliably distinguished. This is useful for several unsupervised learning tasks, such as density estimation and data synthesis. Methods for both are implemented in this package. ARFs naturally handle unstructured data with mixed continuous and categorical covariates. They inherit many of the benefits of random forests, including speed, flexibility, and solid performance with default parameters.

Introduction

Unsupervised learning on tabular data—specifically density estimation and data synthesis—is notoriously difficult when dealing with mixed data types (continuous and categorical) and complex non-linear dependencies. Deep generative models like GANs or VAEs often require extensive hyperparameter tuning and large datasets to converge. Conversely, traditional statistical methods often struggle with high-dimensional interactions.

The arf package addresses this gap by leveraging the strengths of Random Forests (RFs)—speed, scalability, and minimal tuning—to create a generative model that learns the underlying structure of data through an adversarial process.

The Adversarial Random Forest Algorithm

The core innovation is the Adversarial Random Forest algorithm, which operates in an iterative loop to achieve local independence within leaves. The process follows these steps:

  1. Generation: Initially, synthetic data is created via independent bootstraps of each feature, which destroys all correlations.
  2. Discrimination: A Random Forest classifier is trained to distinguish between the "real" data and the "synthetic" data.
  3. Refinement: The splits learned by the classifier are used to generate increasingly realistic synthetic data in the next round.
  4. Convergence: The process repeats until the classifier can no longer reliably distinguish between real and synthetic samples (i.e., Out-of-Bag accuracy drops near 0.5).
Parameters for the core `adversarial_rf` function, illustrating the iterative control mechanisms such as `max_iters` and the convergence tolerance `delta`.

The goal is to partition data until features are jointly independent within each leaf. This simplifies a complex global distribution into a collection of many simple, factorized local distributions.

Density Estimation and Synthesis

Once the forest is trained, the package utilizes two key sub-routines:

  • FORDE (Forests for Density Estimation): Extracts parameters (like mean and variance) from the forest's leaves to create a "probabilistic circuit."
  • FORGE (Forests for Generative Modeling): Samples from these leaves to simulate new, realistic data points.

The package provides a one-stop shop for likelihood estimation (lik), expectation calculation (expct), and data synthesis (forge). A dedicated impute function also uses the generative power of the forest to fill in missing data more accurately than simple mean/mode substitution.

Arguments for the `expct` function, highlighting the support for complex conditioning through the `evidence` parameter, which allows for "what-if" analysis.

Key Insights and Flexibility

ARFs inherit the ability to handle missing values, high dimensionality, and mixed data types with very little manual intervention. Furthermore, the package allows for sophisticated conditional queries. Users can compute expectations for specific variables given a set of conditioning events (evidence), which can take the form of partial samples, data frames with inequalities, or posterior distributions.

Limitations

While powerful, the authors note some limitations:

  • Convergence: Convergence is not guaranteed in finite samples, especially with very complex dependencies.
  • Distributional Assumptions: Currently, forde only supports a limited number of distributional families for continuous data (truncated normal or uniform).
  • Computational Overhead: The iterative nature of the adversarial loop makes it more computationally expensive than a standard, single-pass Random Forest, though it remains faster than many deep learning approaches.

For details, see Watson et al. (2023) https://proceedings.mlr.press/v206/watson23a.html.

Summary updated

Abstract

Adversarial random forests (ARFs) recursively partition data into fully factorized leaves, where features are jointly independent. The procedure is iterative, with alternating rounds of generation and discrimination. Data becomes increasingly realistic at each round, until original and synthetic samples can no longer be reliably distinguished. This is useful for several unsupervised learning tasks, such as density estimation and data synthesis. Methods for both are implemented in this package. ARFs naturally handle unstructured data with mixed continuous and categorical covariates. They inherit many of the benefits of random forests, including speed, flexibility, and solid performance with default parameters. For details, see Watson et al. (2023) &lt;<a href="https://proceedings.mlr.press/v206/watson23a.html" target="_top">https://proceedings.mlr.press/v206/watson23a.html</a>&gt;.
BibTeX
@inproceedings{wright2022arf,
  author = {Marvin N. Wright and David Watson and Kristin Blesch and Jan Kapar},
  title = {{arf: Adversarial Random Forests}},
  booktitle = {Openalex Unknown},
  year = {2022},
  doi = {10.32614/cran.package.arf},
}
Figure