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

Description Details mlr3spatiotempcv notes Super class Active bindings Methods Note References Examples

Description

Create spatial, temporal or spatio-temporal Folds for cross validation

Details

Using "class" is helpful in the case that data are clustered in space and are categorical. E.g This is the case for land cover classifications when training data come as training polygons. In this case the data should be split in a way that entire polygons are held back (spacevar="polygonID") but at the same time the distribution of classes should be similar in each fold (class="LUC").

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

Inherited 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.

Note

Standard k-fold cross-validation can lead to considerable misinterpretation in spatial-temporal modelling tasks. This function can be used to prepare a Leave-Location-Out, Leave-Time-Out or Leave-Location-and-Time-Out cross-validation as target-oriented validation strategies for spatial-temporal prediction tasks. See Meyer et al. (2018) for further information.

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. doi: 10.1016/j.envsoft.2017.12.001.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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

mlr-org/mlr3spatiotempcv documentation built on May 4, 2021, 9:44 a.m.