autoplot.PredictionRegr {mlr3viz}R Documentation

Plots for Regression Predictions

Description

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

Usage

## S3 method for class 'PredictionRegr'
autoplot(
  object,
  type = "xy",
  binwidth = NULL,
  theme = theme_minimal(),
  quantile = 1.96,
  ...
)

Arguments

object

(mlr3::PredictionRegr).

type

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

binwidth

(integer(1))
Width of the bins for the histogram.

theme

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

quantile

(numeric(1))
Quantile multiplier for standard errors for type="confidence". Default 1.96.

...

(ignored).

Value

ggplot2::ggplot().

Examples

if (requireNamespace("mlr3")) {
  library(mlr3)
  library(mlr3viz)

  task = tsk("boston_housing")
  learner = lrn("regr.rpart")
  object = learner$train(task)$predict(task)

  head(fortify(object))
  autoplot(object)
  autoplot(object, type = "histogram", binwidth = 1)
  autoplot(object, type = "residual")

 if (requireNamespace("mlr3learners")) {
  library(mlr3learners)
  learner = lrn("regr.ranger", predict_type = "se")
  object = learner$train(task)$predict(task)
  autoplot(object, type = "confidence")
 }
}

[Package mlr3viz version 0.9.0 Index]