autoplot.LearnerClassifRpart {mlr3viz}R Documentation

Plots for Rpart Learners

Description

Visualizations for mlr3::LearnerClassifRpart. The argument type controls what kind of plot is drawn. Possible choices are:

Usage

## 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(),
  ...
)

Arguments

object

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

type

(character(1)):
Type of the plot. See description.

task

(mlr3::Task)
Train task.

grid_points

(integer(1))
Number of grid points per feature dimension.

expand_range

(numeric(1))
Expand the range of the grid.

theme

(ggplot2::theme())
The ggplot2::theme_minimal() is applied by default to all plots.

...

(ignored).

Value

ggplot2::ggplot().

Examples

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")
}

[Package mlr3viz version 0.8.0 Index]