Learn R Programming

mlr3spatiotempcv (version 1.0.1)

ResamplingSptCVCstf: (CAST) "Leave-location-and-time-out" resampling

Description

(CAST) "Leave-location-and-time-out" resampling

(CAST) "Leave-location-and-time-out" resampling

Arguments

mlr3spatiotempcv notes

The 'Description', 'Details' and 'Note' fields are inherited from the respective upstream function.

For a list of available arguments, please see CAST::CreateSpacetimeFolds.

Super class

mlr3::Resampling -> ResamplingSptCVCstf

Active bindings

iters

integer(1) Returns the number of resampling iterations, depending on the values stored in the param_set.

Methods

Public methods

Method new()

Create a "Spacetime Folds" resampling instance.

For a list of available arguments, please see CAST::CreateSpacetimeFolds.

Usage

ResamplingSptCVCstf$new(id = "sptcv_cstf")

Arguments

id

character(1) Identifier for the resampling strategy.

Method instantiate()

Materializes fixed training and test splits for a given task.

Usage

ResamplingSptCVCstf$instantiate(task)

Arguments

task

Task A task to instantiate.

Method clone()

The objects of this class are cloneable with this method.

Usage

ResamplingSptCVCstf$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

References

Meyer H, Reudenbach C, Hengl T, Katurji M, Nauss T (2018). “Improving performance of spatio-temporal machine learning models using forward feature selection and target-oriented validation.” Environmental Modelling & Software, 101, 1--9. 10.1016/j.envsoft.2017.12.001.

Examples

Run this code
# NOT RUN {
library(mlr3)
task = tsk("cookfarm")

# Instantiate Resampling
rcv = rsmp("sptcv_cstf",
  folds = 5,
  time_var = "Date", space_var = "SOURCEID")
rcv$instantiate(task)

# Individual sets:
rcv$train_set(1)
rcv$test_set(1)
# check that no obs are in both sets
intersect(rcv$train_set(1), rcv$test_set(1)) # good!

# Internal storage:
rcv$instance # table
# }

Run the code above in your browser using DataLab