v1.2.0 · On CRAN

Ensemble power.
One tree to explain it.

e2tree distils any ensemble of decision trees into a single, interpretable tree — preserving predictive accuracy while delivering transparent, human-readable decision rules. Supports classification and regression with any tree-based ensemble.

Abstract

Ensemble accuracy. Single-tree transparency.

Ensemble methods based on decision trees routinely outperform single decision trees, but at the cost of interpretability: hundreds of learners whose joint reasoning is opaque to practitioners and regulators alike.

e2tree resolves this by deriving a co-occurrence matrix from the ensemble — how often any two observations share a terminal node across all trees — then using that dissimilarity structure to grow a single tree that summarises the ensemble's behaviour.

The result is a concise decision tree whose split rules, variable importances, and local interpretations faithfully reproduce what the ensemble learned — with no drop in predictive performance.

The framework supports both classification and regression tasks, integrates with randomForest and ranger, and is fully open-source on CRAN under the MIT license.

#explainability #ensemble-trees #decision-tree #XAI #open-science
The core idea

From 500+ trees to
one decision you can explain.

Case study: Heart Disease Risk Stratification — the e2tree distils 500 ensemble trees into six clear, auditable decision rules a cardiologist can act on.

Full use cases
Interactive — e2tree distillation engine

Press Distil → then hover any leaf node to read the full decision path. The panel below will explain each rule in clinical terms.

Workflow

From raw data to interpretable rules in six steps.

Each function maps to one step. Every intermediate object is inspectable and exportable.

Full documentation
  1. 01
    Train a tree-based ensemble

    Use randomForest() or ranger(). Any standard training configuration works.

  2. 02
    Compute the dissimilarity matrix

    createDisMatrix() derives a co-occurrence matrix O from the ensemble's terminal node structure. Each entry oij ∈ [0,1] measures how often observations i and j share a leaf across all trees. The dissimilarity is D = 1 − O.

  3. 03
    Build the explainable tree

    e2tree() grows the single tree guided by the dissimilarity structure. Depth, impurity threshold, and node size are controlled via the setting list.

  4. 04
    Inspect and visualize

    Standard S3 methods — print(), summary(), plot() — provide a compact overview, detailed decision rules, and visual rendering via rpart.plot or partykit.

  5. 05
    Predict and validate

    predict() routes new observations through the split rules. eValidation() checks how closely the tree matches the ensemble's proximity structure.

  6. 06
    Local and global importance

    vimp() computes variable importance from the tree's split structure. loi() provides observation-level local importance with optional permutation-based significance testing.

Quick start

Five lines from ensemble to tree.

Five steps from raw data to an interpretable tree. Install from CRAN and run it today.

# Install from CRAN install.packages("e2tree") library(e2tree) library(randomForest) # or ranger # 1. Train an ensemble of decision trees ensemble <- randomForest( Species ~ ., data = training, importance = TRUE, proximity = TRUE ) # 2. Compute dissimilarity from ensemble co-occurrence D <- createDisMatrix( ensemble, data = training, label = "Species", parallel = list(active = FALSE) ) # 3. Build the single explainable tree setting <- list(impTotal = 0.1, maxDec = 0.01, n = 2, level = 5) tree <- e2tree(Species ~ ., training, D, ensemble, setting) # 4. Inspect, visualize, predict print(tree) plot(tree, ensemble = ensemble) pred <- predict(tree, newdata = validation)
Capabilities

A complete suite for explainable ensemble analysis.

01

Classification & Regression

Works for both classification (factor response) and regression (continuous response). The workflow is the same in both cases.

randomForest ranger rpart-compatible
02

Structural Validation

eValidation() measures how closely the e2tree matches the ensemble's proximity structure. It returns concordance metrics and a proximity heatmap.

proximity fidelity metrics
03

Variable & Local Importance

vimp() provides global variable importance from the tree structure. loi() adds observation-level importance with optional permutation-based significance testing.

global importance local importance permutation test
04

Rich Interoperability

e2tree objects convert to rpart format (for rpart.plot) or to partykit's constparty format. Both give access to the standard R tree visualization tools.

as.rpart() as.party() rpart.plot partykit
Publications

Peer-reviewed methodology.

Two peer-reviewed papers describe the method — one for classification, one for regression.

Classification · 2024

Aria, M., Gnasso, A., Iorio, C., & Pandolfo, G. (2024). Explainable ensemble trees. Computational Statistics, 39(1), 3–19. doi:10.1007/s00180-022-01312-6 ↗

Regression · 2026

Aria, M., Gnasso, A., Iorio, C., & Fokkema, M. (2026). Extending Explainable Ensemble Trees to Regression Contexts. Applied Stochastic Models in Business and Industry, 42(1), e70064. doi:10.1002/asmb.70064 ↗