Splits data using a folds-folds (default: 10 folds) cross-validation.

Format

R6::R6Class inheriting from Resampling.

Construction

ResamplingCV$new()
mlr_resamplings$get("cv")
rsmp("cv")

Fields

See Resampling.

Methods

See Resampling.

Parameters

See also

Dictionary of Resamplings: mlr_resamplings

as.data.table(mlr_resamplings) for a complete table of all (also dynamically created) Resampling implementations.

Examples

# Create a task with 10 observations task = tsk("iris") task$filter(1:10) # Instantiate Resampling rcv = rsmp("cv", folds = 3) rcv$instantiate(task) # Individual sets: rcv$train_set(1)
#> [1] 6 7 9 2 3 8
rcv$test_set(1)
#> [1] 1 4 5 10
intersect(rcv$train_set(1), rcv$test_set(1))
#> integer(0)
# Internal storage: rcv$instance # table
#> row_id fold #> 1: 1 1 #> 2: 4 1 #> 3: 5 1 #> 4: 10 1 #> 5: 6 2 #> 6: 7 2 #> 7: 9 2 #> 8: 2 3 #> 9: 3 3 #> 10: 8 3