Learn R Programming

fastml (version 0.7.7)

surrogate_tree: Fit a surrogate decision tree for a fastml model

Description

Builds an interpretable tree approximating the behaviour of the underlying model using the `iml` package.

Usage

surrogate_tree(object, maxdepth = 3, data = c("train", "test"), ...)

Value

An `iml::TreeSurrogate` object.

Arguments

object

A `fastml` object.

maxdepth

Maximum depth of the surrogate tree. Default 3.

data

Character string specifying which data to use: "train" (default) or "test".

...

Additional arguments passed to `iml::TreeSurrogate`.

Examples

Run this code
if (FALSE) {
data(iris)
iris <- iris[iris$Species != "setosa", ]
iris$Species <- factor(iris$Species)
model <- fastml(data = iris, label = "Species")
surrogate_tree(model)
}

Run the code above in your browser using DataLab