ResamplingRepeatedSptCVCstf: (CAST) Repeated "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 -> ResamplingRepeatedSptCVCstf

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
ResamplingRepeatedSptCVCstf$new(id = "repeated_sptcv_cstf")
Arguments
id

character(1)
Identifier for the resampling strategy.


Method folds()

Translates iteration numbers to fold number.

Usage
ResamplingRepeatedSptCVCstf$folds(iters)
Arguments
iters

integer()
Iteration number.


Method repeats()

Translates iteration numbers to repetition number.

Usage
ResamplingRepeatedSptCVCstf$repeats(iters)
Arguments
iters

integer()
Iteration number.


Method instantiate()

Materializes fixed training and test splits for a given task.

Usage
ResamplingRepeatedSptCVCstf$instantiate(task)
Arguments
task

Task
A task to instantiate.


Method clone()

The objects of this class are cloneable with this method.

Usage
ResamplingRepeatedSptCVCstf$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

Zhao Y, Karypis G (2002). “Evaluation of Hierarchical Clustering Algorithms for Document Datasets.” 11th Conference of Information and Knowledge Management (CIKM), 51-524. http://glaros.dtc.umn.edu/gkhome/node/167.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(mlr3)
library(mlr3spatiotempcv)
task = tsk("cookfarm")

# Instantiate Resampling
rrcv = rsmp("repeated_sptcv_cstf", folds = 3, repeats = 5, time_var = "Date")
rrcv$instantiate(task)
# Individual sets:
rrcv$iters
rrcv$folds(1:6)
rrcv$repeats(1:6)

# Individual sets:
rrcv$train_set(1)
rrcv$test_set(1)
intersect(rrcv$train_set(1), rrcv$test_set(1))

# Internal storage:
rrcv$instance # table

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