autoplot.LearnerClassifRpart: Plot for LearnerClassifRpart / LearnerRegrRpart

Description Usage Arguments Value Examples

View source: R/LearnerClassifRpart.R

Description

Visualize trees for mlr3::mlr_learners_classif.rpart and mlr3::mlr_learners_regr.rpart using the package ggparty.

Contrary to ggparty, boxplots are shown in the terminal nodes for regression trees.

Note that learner-specific plots are experimental and subject to change.

Usage

1
2
3
4
5
## S3 method for class 'LearnerClassifRpart'
autoplot(object, ...)

## S3 method for class 'LearnerRegrRpart'
autoplot(object, ...)

Arguments

object

(mlr3::LearnerClassifRpart | mlr3::LearnerRegrRpart).

...

(any): Additional arguments, passed down to ggparty::autoplot.party().

Value

ggplot2::ggplot() object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(mlr3)
library(mlr3viz)

# classification
task = tsk("iris")
learner = lrn("classif.rpart", keep_model = TRUE)
learner$train(task)
autoplot(learner)

# regression
task = tsk("mtcars")
learner = lrn("regr.rpart", keep_model = TRUE)
learner$train(task)
autoplot(learner)

Example output



mlr3viz documentation built on July 2, 2021, 1:07 a.m.