View source: R/LearnerClassifRpart.R
autoplot.LearnerClassifRpart | R Documentation |
Visualizations for mlr3::LearnerClassifRpart.
The argument type
controls what kind of plot is drawn.
Possible choices are:
"prediction"
(default): Decision boundary of the learner and the true class labels.
"ggparty"
: Visualizes the tree using the package ggparty.
## S3 method for class 'LearnerClassifRpart'
autoplot(
object,
type = "prediction",
task = NULL,
grid_points = 100L,
expand_range = 0,
theme = theme_minimal(),
...
)
## S3 method for class 'LearnerRegrRpart'
autoplot(
object,
type = "prediction",
task = NULL,
grid_points = 100L,
expand_range = 0,
theme = theme_minimal(),
...
)
object |
(mlr3::LearnerClassifRpart | mlr3::LearnerRegrRpart). |
type |
(character(1)): |
task |
(mlr3::Task) |
grid_points |
(integer(1)) |
expand_range |
(numeric(1)) |
theme |
( |
... |
(ignored). |
ggplot2::ggplot()
.
if (requireNamespace("mlr3")) {
library(mlr3)
library(mlr3viz)
# classification
task = tsk("iris")
learner = lrn("classif.rpart", keep_model = TRUE)
learner$train(task)
autoplot(learner, type = "ggparty")
# regression
task = tsk("mtcars")
learner = lrn("regr.rpart", keep_model = TRUE)
learner$train(task)
autoplot(learner, type = "ggparty")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.