Changelog

Release notes.

What's new in each e2tree release. Condensed from the package NEWS.md on GitHub.

1.2.0.9000 Development · on GitHub

Install with remotes::install_github("agostinognasso/e2tree").

Local explainability layer

  • e2tree is interpretive, not predictive: it reconstructs the grouping geometry a trained ensemble induces, and its quality is fidelity to that ensemble, never predictive accuracy. This release brings that lens down to the local scale. All functions are backend-agnostic.
  • explain(): a single per-instance entry point composing routing, additive attribution, ensemble neighbours, region fidelity, outcome dispersion — and, on request, counterfactuals and stability — into one coherent narrative object.
  • localLoI(): disaggregates the global nLoI into per-node and per-observation fidelity, so you can see where the reconstruction is reliable. mean(obs$loi) reproduces nLoI exactly.
  • eContribution(): exactly additive per-instance Saabas-style attribution of the reconstructed value, per class for classification.
  • eNeighbors(): case-based explanation returning the nearest training cases by the ensemble's own leaf co-occurrence proximity, plus leaf prototypes.
  • eHeterogeneity(): descriptive per-region outcome dispersion — entropy and prediction set for classification, central band and sd for regression.
  • nodeStats() and plotNodeComparison(): full profile of any node (decision rule, per-predictor node-vs-rest statistics via Cohen's d and Cramér's V, response distribution), and side-by-side comparison of two nodes.

Advanced local explanation

  • eCounterfactual(): proximity-native contrastive explanation. Reports the smallest feature change that would move an instance into a different region, and verifies it against the ensemble's own grouping geometryvalidated is TRUE only when the forest actually regroups the counterfactual. This is what distinguishes it from surrogate-only counterfactuals, which can flip the approximating tree without convincing the ensemble.
  • eStability(): confidence and stability of a local explanation via bootstrap over the ensemble's trees, yielding a per-instance confidence, a neighbour-stability score, and an interval on the reconstructed outcome. Fills the usual XAI gap of point estimates with no uncertainty.

Panel (longitudinal) data

  • panel_e2tree(): explains an ensemble fitted to panel (unit × time) data by decomposing the feature representation à la Mundlak (1978) into a between (unit-mean) and a within (unit-demeaned) component, growing a separate e2tree surrogate for each. On panels with high intraclass correlation a single pooled e2tree conflates the two sources and the within signal is crowded out.
  • target = "pooled" explains a given pooled ensemble; within = "twoway" adds two-way demeaning with common period effects; na.action = "unit.available" reduces bias in unbalanced panels.
  • New panel_health dataset: a simulated country × year panel (30 countries, 2004–2019) of life-expectancy determinants with known between and within drivers and high ICC (≈ 0.96).

Fidelity semantics and performance

  • Full-ensemble predictions are now the default for fidelity computations; out-of-bag predictions remain available via oob = TRUE. A length check catches silent misalignment.
  • Quantile binning of split thresholds: numeric predictors with more unique values than max_thresholds (default 256) contribute at most that many quantile-based candidate splits, bounding the split matrix at O(n · max_thresholds) per feature instead of O(n²) on continuous data.
  • predict.e2tree() (regression) attaches node-level sd via the terminal-node id, fixing wrong values when two leaves share the same prediction.
  • Wtest() now respects its p.value argument, which was hard-coded to 0.05.

Robustness fixes

  • LightGBM feature-name sanitisation: LightGBM rewrites any character outside [A-Za-z0-9_] in feature names, so models whose predictors contained spaces or special characters broke leaf extraction. The adapter now resolves the model's feature names against data (exact match first, sanitised match as fallback) and errors clearly on ambiguity.
1.2.0 Current · on CRAN May 2026

Multi-backend support

  • Hardened adapters for ensembles trained with xgboost (including 3.x), gbm, lightgbm, and catboost — alongside the original randomForest and ranger backends.
  • createDisMatrix() now validates adapter output via validate_terminal_nodes(), rejecting malformed terminal-node matrices with an informative error.
  • Dissimilarity matrices carry an ensemble_backend tag; e2tree() and as.rpart() warn when a stale D is reused with a different model.
  • CatBoost robustness: multi-class leaf extraction, loss-function parsing across catboost releases, and compatibility with both catboost.CatBoost and catboost.Model classes.

S3 class system overhaul

  • New S3 methods for e2tree objects: predict(), fitted(), residuals()predict.e2tree() replaces ePredTree() as the standard prediction interface.
  • New accessors: nodes(), e2splits(), measures(), proximity().
  • New coercion methods: as.rpart() and as.party() (partykit constparty, with proper bar plots in terminal nodes).

Validation & importance

  • eValidation() gains a test argument: "mantel", "measures", or "both".
  • vimp() auto-detects classification vs regression; importance bars sorted; consistent column naming.
  • moda() accepts non-factor responses (integer 0/1 targets typical of gbm Bernoulli models).

Documentation

  • New vignette e2tree-introduction covering classification, regression, validation, and comparison with partykit/stablelearner.
  • New vignette models with worked examples for every supported backend.
1.0.0 2025

New functions

  • goi(), goi_perm(), goi_analysis(): the Goodness of Interpretability index — how well the e2tree-estimated proximity matrix reconstructs the ensemble's — with permutation-based significance testing. Since superseded by loi() / loi_perm(), the normalized Loss of Interpretability.
  • Interactive visualization: plot_e2tree_vis() (draggable visNetwork trees), plot_e2tree_click() (click-to-inspect nodes), save_e2tree_html() (standalone HTML export).

Performance

  • createDisMatrix() co-occurrence computation moved to C++ with OpenMP thread-level parallelism.
  • Prediction rules pre-parsed once, eliminating repeated regex/eval(parse()) calls; vectorized splitting and impurity computation.

Bug fixes

  • Fixed Rcpp type conversion for ranger compatibility.
  • Fixed regression predictions returned as character instead of double.
  • Fixed a dplyr namespace conflict and missing NAMESPACE imports.
0.2.0 2024
  • Added support for ranger models.
  • Several improvements to e2tree plots.
0.1.x 2023
  • First public releases on CRAN: core algorithm for classification with randomForest ensembles.

Get the latest version.