autoplot.ResamplingCV: Visualization Functions for Non-Spatial CV Methods.

View source: R/autoplot.R

autoplot.ResamplingCVR Documentation

Visualization Functions for Non-Spatial CV Methods.

Description

Generic S3 plot() and autoplot() (ggplot2) methods.

Usage

## S3 method for class 'ResamplingCV'
autoplot(
  object,
  task,
  fold_id = NULL,
  plot_as_grid = TRUE,
  train_color = "#0072B5",
  test_color = "#E18727",
  sample_fold_n = NULL,
  ...
)

## S3 method for class 'ResamplingRepeatedCV'
autoplot(
  object,
  task,
  fold_id = NULL,
  repeats_id = 1,
  plot_as_grid = TRUE,
  train_color = "#0072B5",
  test_color = "#E18727",
  sample_fold_n = NULL,
  ...
)

## S3 method for class 'ResamplingCV'
plot(x, ...)

## S3 method for class 'ResamplingRepeatedCV'
plot(x, ...)

Arguments

object

⁠[Resampling]⁠
mlr3 spatial resampling object of class ResamplingCV or ResamplingRepeatedCV.

task

⁠[TaskClassifST]/[TaskRegrST]⁠
mlr3 task object.

fold_id

⁠[numeric]⁠
Fold IDs to plot.

plot_as_grid

⁠[logical(1)]⁠
Should a gridded plot using via patchwork be created? If FALSE a list with of ggplot2 objects is returned. Only applies if a numeric vector is passed to argument fold_id.

train_color

⁠[character(1)]⁠
The color to use for the training set observations.

test_color

⁠[character(1)]⁠
The color to use for the test set observations.

sample_fold_n

⁠[integer]⁠
Number of points in a random sample stratified over partitions. This argument aims to keep file sizes of resulting plots reasonable and reduce overplotting in dense datasets.

...

Passed to geom_sf(). Helpful for adjusting point sizes and shapes.

repeats_id

⁠[numeric]⁠
Repetition ID to plot.

x

⁠[Resampling]⁠
mlr3 spatial resampling object of class ResamplingCV or ResamplingRepeatedCV.

See Also

  • mlr3book chapter on "Spatial Analysis"

  • autoplot.ResamplingSpCVBlock()

  • autoplot.ResamplingSpCVBuffer()

  • autoplot.ResamplingSpCVCoords()

  • autoplot.ResamplingSpCVEnv()

  • autoplot.ResamplingSpCVDisc()

  • autoplot.ResamplingSpCVTiles()

  • autoplot.ResamplingSptCVCstf()

Examples


if (mlr3misc::require_namespaces(c("sf", "patchwork", "ggtext", "ggsci"), quietly = TRUE)) {
  library(mlr3)
  library(mlr3spatiotempcv)
  task = tsk("ecuador")
  resampling = rsmp("cv")
  resampling$instantiate(task)

  autoplot(resampling, task) +
    ggplot2::scale_x_continuous(breaks = seq(-79.085, -79.055, 0.01))
  autoplot(resampling, task, fold_id = 1)
  autoplot(resampling, task, fold_id = c(1, 2)) *
    ggplot2::scale_x_continuous(breaks = seq(-79.085, -79.055, 0.01))
}


mlr-org/mlr3spatiotempcv documentation built on Feb. 9, 2024, 9:30 p.m.