View source: R/SurrogateTree.R
SurrogateTree | R Documentation |
Builds a surrogate tree to approximate a conditional random forest model.
SurrogateTree(object, mincriterion = 0.95, maxdepth = 3)
object |
An object as returned by |
mincriterion |
the value of the test statistic (for |
maxdepth |
maximum depth of the tree. Default is 3. |
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.
A list withe following items :
tree |
The surrogate tree, of class |
r.squared |
The R squared of a linear regression with random forests prediction as dependent variable and surrogate tree prediction as predictor |
The surrogate tree is built using ctree
from partykit
package.
Nicolas Robette
Molnar, Christoph. "Interpretable machine learning. A Guide for Making Black Box Models Explainable", 2019. https://christophm.github.io/interpretable-ml-book/.
cforest
, ctree
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.