autoplot.ResampleResult {mlr3viz}R Documentation

Plots for Resample Results

Description

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

Usage

## S3 method for class 'ResampleResult'
autoplot(
  object,
  type = "boxplot",
  measure = NULL,
  predict_sets = "test",
  binwidth = NULL,
  theme = theme_minimal(),
  ...
)

Arguments

object

(mlr3::ResampleResult).

type

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

measure

(mlr3::Measure)
Performance measure to use.

predict_sets

(character())
Only for type set to "prediction". Which points should be shown in the plot? Can be a subset of ("train", "test") or empty.

binwidth

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

theme

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

...

(ignored).

Value

ggplot2::ggplot().

References

Saito T, Rehmsmeier M (2017). “Precrec: fast and accurate precision-recall and ROC curve calculations in R.” Bioinformatics, 33(1), 145-147. doi:10.1093/bioinformatics/btw570.

Examples


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

  task = tsk("sonar")
  learner = lrn("classif.rpart", predict_type = "prob")
  resampling = rsmp("cv", folds = 3)
  object = resample(task, learner, resampling)

  head(fortify(object))

  # Default: boxplot
  autoplot(object)

  # Histogram
  autoplot(object, type = "histogram", bins = 30)

  # ROC curve, averaged over resampling folds:
  autoplot(object, type = "roc")

  # ROC curve of joint prediction object:
  autoplot(object$prediction(), type = "roc")

  # Precision Recall Curve
  autoplot(object, type = "prc")

  # Prediction Plot
  task = tsk("iris")$select(c("Sepal.Length", "Sepal.Width"))
  resampling = rsmp("cv", folds = 3)
  object = resample(task, learner, resampling, store_models = TRUE)
  autoplot(object, type = "prediction")
}


[Package mlr3viz version 0.9.0 Index]