NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Joints in Random Forests

Alvaro H. C. Correia, Robert Peharz, Cassio P. de Campos

Random Forests (RFs) and Decision Trees (DTs) are often considered the "gold standard" for tabular data. However, because they are fundamentally discriminative models—learning the conditional distribution $P(Y | X)$ to predict a label $Y$ given features $X$—they struggle with two major real-world challenges: handling missing data and detecting outliers.

When features are missing at test time, standard RFs require external imputation methods (like mean or K-Nearest Neighbors), which can be computationally expensive or theoretically inconsistent. Furthermore, because discriminative models are "blind" to the input distribution $P(X)$, they cannot natively detect out-of-distribution samples or outliers.

This paper bridges the gap between the high predictive performance of discriminative RFs and the flexibility of generative models by reinterpreting trees as Probabilistic Circuits. The resulting models, Generative Decision Trees (GeDTs) and Generative Forests (GeFs), can handle missing data through exact marginalization and detect outliers natively, all while maintaining the predictive power of the original forest.

From Discriminative Trees to Generative Circuits

The core innovation of this work is a structural mapping between Decision Trees and Probabilistic Circuits (PCs)—a class of tractable models that represent probability distributions as computational graphs of sum and product nodes.

Mapping a standard Decision Tree to a Generative Decision Tree (Probabilistic Circuit).

The conversion process transforms a standard tree into a GeDT as follows:

  • Internal Nodes: Every split in a decision tree is converted into a sum node in a PC. The weights of these sum nodes are determined by the fraction of training samples that flowed through that specific branch during training.
  • Leaf Nodes: Instead of merely storing a class label, the leaves are transformed into distribution nodes that model the local joint distribution of features and labels, $P(X, Y)$.

This structural shift changes how the model handles missing information. Instead of "filling in the blanks" via imputation, a GeDT marginalizes out the missing features. Because the model is structured as a Probabilistic Circuit, this complex integration is mathematically exact and can be computed efficiently in a single feedforward pass. Crucially, the authors prove a "backwards compatibility" theorem: if simple class-factorized leaves are used, the GeDT produces the exact same predictions as the original discriminative DT on complete data.

Key Insights

  • RFs are Secretly Generative: The structure of a Random Forest already contains the "skeleton" of a generative model. By tracking sample counts at nodes during training, practitioners can unlock generative capabilities without changing the fundamental tree-building process.
  • Theoretical Consistency: Standard imputation techniques (like KNN) are not always "Bayes consistent," meaning they might yield incorrect answers even with infinite data. GeFs, however, are proven to be consistent under the Missing At Random (MAR) assumption.
  • Tractable "All-Round" Predictors: Because GeFs model the full joint distribution $P(X, Y)$, they are highly versatile. They can predict any missing variable given the others, rather than being restricted to solely predicting the target label $Y$.

Empirical Results

The researchers evaluated GeFs across a wide array of benchmarks, including 21 diverse tabular datasets from OpenML-CC18, the Wine Quality dataset for outlier detection, and several image datasets to test domain shift.

Superiority in Missing Data: In experiments across the tabular datasets, GeFs consistently outperformed standard RFs paired with KNN or MissForest imputation. As the percentage of missing values increased (up to 80%), the accuracy gap in favor of GeFs widened significantly.

Accuracy gain of various methods relative to RF + KNN imputation across different missingness rates.

Outlier Detection: By monitoring the marginal probability $P(X)$, GeFs successfully identified out-of-distribution samples. For example, when trained only on white wine, the model could spot red wine samples with high reliability (AUC ROC > 0.98), significantly outperforming the entropy-based baselines of standard RFs.

Computational Efficiency: The computational complexity of using a GeF for missing data is comparable to a standard RF. In contrast, advanced iterative imputation methods like MissForest are often orders of magnitude slower, making GeFs highly attractive for real-time or resource-constrained applications.

Limitations and Future Work

While GeFs offer a powerful new paradigm, the authors note a few areas for future exploration. The simplest version of the GeDT assumes features are independent within a leaf. Utilizing more expressive leaf models (like LearnSPN) can improve results but adds computational complexity. Additionally, while the underlying theory supports mixed variables (continuous and categorical), robust implementations for competing generative structures remain a challenge. Finally, while the extension to regression tasks is theoretically straightforward, empirical validation for regression is left for future work.

Summary updated

BibTeX
@inproceedings{correia2020joints,
  author = {Alvaro H. C. Correia and Robert Peharz and Cassio P. de Campos},
  title = {{Joints in Random Forests}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
  url = {https://openreview.net/forum?id=cANoC-lViR},
}
Figure