Invariant Random Forest: Tree-Based Model Solution for OOD Generalization
Yufan Liao, Qi Wu, Xing Yan
TL;DR
The paper addresses Out-Of-Distribution generalization for tree-based models by introducing Invariant Decision Tree (IDT) and Invariant Random Forest (IRF), which incorporate a penalty to favor splits that are stable across multiple environments. A key theoretical contribution is the invariant ratio $I(Q_m^e, \theta) = CR_{X_j \leq c}^1(Q_m^e) / CR_{X_j \leq c}^0(Q_m^e)$ that remains constant when splits use stable variables, guiding the splitting process. The authors formulate a penalized objective that combines standard impurity with an invariance penalty, enabling practical tree growth under distribution shifts, and validate the approach on synthetic and real datasets where IRF outperforms RF and XGBoost in OOD settings. The work demonstrates that incorporating environment-aware invariance into tree-based methods yields substantial improvements in robustness and generalization, with potential implications for safety-critical and time-varying domains.
Abstract
Out-Of-Distribution (OOD) generalization is an essential topic in machine learning. However, recent research is only focusing on the corresponding methods for neural networks. This paper introduces a novel and effective solution for OOD generalization of decision tree models, named Invariant Decision Tree (IDT). IDT enforces a penalty term with regard to the unstable/varying behavior of a split across different environments during the growth of the tree. Its ensemble version, the Invariant Random Forest (IRF), is constructed. Our proposed method is motivated by a theoretical result under mild conditions, and validated by numerical tests with both synthetic and real datasets. The superior performance compared to non-OOD tree models implies that considering OOD generalization for tree models is absolutely necessary and should be given more attention.
