View source: R/LearnerClassifRpart.R
autoplot.LearnerClassifRpart | R Documentation |
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 class 'LearnerClassifRpart' autoplot(object, ...) ## S3 method for class 'LearnerRegrRpart' autoplot(object, ...)
object |
(mlr3::LearnerClassifRpart | mlr3::LearnerRegrRpart). |
... |
( |
ggplot2::ggplot()
object.
The theme_mlr3()
and viridis color maps are applied by default to all
autoplot()
methods. To change this behavior set
options(mlr3.theme = FALSE)
.
if (requireNamespace("mlr3")) { 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) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.