[Paper Review] Optimal Counterfactual Explanations in Tree Ensembles
This paper proposes a mixed-integer programming framework for generating optimal, actionable, and plausible counterfactual explanations in tree ensembles by modeling decision paths with logarithmic binary variables and integrating isolation forests for plausibility. It achieves optimal solutions in seconds on large-scale datasets, outperforming prior heuristic methods in stability, interpretability, and scalability.
Counterfactual explanations are usually generated through heuristics that are sensitive to the search's initial conditions. The absence of guarantees of performance and robustness hinders trustworthiness. In this paper, we take a disciplined approach towards counterfactual explanations for tree ensembles. We advocate for a model-based search aiming at "optimal" explanations and propose efficient mixed-integer programming approaches. We show that isolation forests can be modeled within our framework to focus the search on plausible explanations with a low outlier score. We provide comprehensive coverage of additional constraints that model important objectives, heterogeneous data types, structural constraints on the feature space, along with resource and actionability restrictions. Our experimental analyses demonstrate that the proposed search approach requires a computational effort that is orders of magnitude smaller than previous mathematical programming algorithms. It scales up to large data sets and tree ensembles, where it provides, within seconds, systematic explanations grounded on well-defined models solved to optimality.
Motivation & Objective
- Address the lack of trustworthiness and robustness in heuristic-based counterfactual explanations for tree ensembles.
- Overcome limitations of existing methods that are sensitive to initial conditions and lack guarantees on solution quality.
- Provide a scalable, mathematically grounded framework that integrates domain-specific constraints such as actionability, plausibility, and data type heterogeneity.
- Enable systematic, optimal counterfactual search with computational efficiency suitable for large-scale datasets and complex models.
- Integrate isolation forests into the optimization model to enforce plausibility by focusing on high-density regions of the feature space.
Proposed method
- Model tree ensemble decision paths using a logarithmic number of binary variables relative to the number of tree vertices, drastically reducing model size compared to prior approaches.
- Formulate the counterfactual search as a mixed-integer linear or quadratic program (MILP/MIQP) to ensure optimality and stability.
- Integrate isolation forest outlier scores as constraints to restrict counterfactuals to low-outlier-score, high-plausibility regions of the feature space.
- Support heterogeneous data types (numerical, ordinal, binary, categorical) and oblique splits via tailored constraint formulations.
- Incorporate actionability and structural constraints through linear and logical constraints within the MILP framework.
- Leverage modern MIP solvers to achieve sub-second solution times on datasets with over 50 features and hundreds of trees.
Experimental results
Research questions
- RQ1Can optimal counterfactual explanations be generated for tree ensembles using mathematical programming with provable guarantees on solution quality and stability?
- RQ2How can plausibility be systematically enforced in counterfactual explanations without relying on distributional assumptions?
- RQ3To what extent does integrating isolation forests improve the plausibility of counterfactuals while maintaining computational efficiency?
- RQ4Can the proposed framework scale to large datasets and complex tree ensembles while remaining practical for real-world deployment?
- RQ5How do additional constraints—such as actionability and feature space structure—affect the performance and quality of counterfactual explanations?
Key findings
- The proposed OCEAN framework generates optimal counterfactual explanations in under 2 seconds on average for datasets with over 50 features and hundreds of trees.
- The integration of isolation forest constraints increases the proportion of plausible counterfactuals from a median of 35% (without constraints) to 100% across all tested datasets.
- The computational cost increases by roughly a factor of two when adding isolation forest constraints, which remains acceptable given the significant gain in plausibility.
- The model achieves 100% plausibility on 6 out of 8 datasets when using isolation forest constraints, compared to only 25–55% without them.
- The framework scales efficiently: solution time remains stable as the number of features increases, due to a sparse constraint matrix and logarithmic variable count.
- The method outperforms prior mathematical programming approaches by reducing the number of binary variables by an exponential factor, enabling scalability to large tree ensembles.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.