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.

# S3 method for LearnerClassifRpart
autoplot(object, ...)

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

Arguments

object

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

...

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

Value

ggplot2::ggplot() object.

Examples

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)