SurrogateTree: Surrogate tree for conditional inference random forests

View source: R/SurrogateTree.R

SurrogateTreeR Documentation

Surrogate tree for conditional inference random forests

Description

Builds a surrogate tree to approximate a conditional random forest model.

Usage

SurrogateTree(object, mincriterion = 0.95, maxdepth = 3)

Arguments

object

An object as returned by cforest (or fastcforest).

mincriterion

the value of the test statistic (for testtype == "Teststatistic"), or 1 - p-value (for other values of testtype) that must be exceeded in order to implement a split.

maxdepth

maximum depth of the tree. Default is 3.

Details

A global surrogate model is an interpretable model that is trained to approximate the predictions of a black box model (see Molnar 2019). Here a conditional inference tree is build to approximate the prediction of a conditional inference random forest. Practically, the surrogate tree takes the forest predictions as response and the same predictors as the forest.

Value

A list withe following items :

tree

The surrogate tree, of class party

r.squared

The R squared of a linear regression with random forests prediction as dependent variable and surrogate tree prediction as predictor

Note

The surrogate tree is built using ctree from partykit package.

Author(s)

Nicolas Robette

References

Molnar, Christoph. "Interpretable machine learning. A Guide for Making Black Box Models Explainable", 2019. https://christophm.github.io/interpretable-ml-book/.

See Also

cforest, ctree

Examples

  data(iris)
  iris2 = iris
  iris2$Species = factor(iris$Species == "versicolor")
  iris.cf = party::cforest(Species ~ ., data = iris2,
            control = party::cforest_unbiased(mtry = 2, ntree = 50))
  surro <- SurrogateTree(iris.cf)
  surro$r.squared
  plot(surro$tree)

moreparty documentation built on Nov. 22, 2023, 5:08 p.m.