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

The iteration counter translates to repeats blocks of folds cross-validations, i.e., the first folds iterations belong to a single cross-validation.

Format

R6::R6Class() inheriting from Resampling.

Construction

ResamplingRepeatedCV$new()
mlr_resamplings$get("repeated_cv")
rsmp("repeated_cv")

Fields

See Resampling.

Methods

See Resampling. Additionally, the class provides two helper function to translate iteration numbers to folds / repeats:

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 rrcv = rsmp("repeated_cv", repeats = 2, folds = 3) rrcv$instantiate(task) rrcv$iters
#> [1] 6
rrcv$folds(1:6)
#> [1] 1 2 1 2 1 2
rrcv$repeats(1:6)
#> [1] 1 1 1 2 2 2
# Individual sets: rrcv$train_set(1)
#> [1] 1 7 8 2 3 6
rrcv$test_set(1)
#> [1] 4 5 9 10
intersect(rrcv$train_set(1), rrcv$test_set(1))
#> integer(0)
# Internal storage: rrcv$instance # table
#> row_id rep fold #> 1: 1 1 2 #> 2: 2 1 3 #> 3: 3 1 3 #> 4: 4 1 1 #> 5: 5 1 1 #> 6: 6 1 3 #> 7: 7 1 2 #> 8: 8 1 2 #> 9: 9 1 1 #> 10: 10 1 1 #> 11: 1 2 1 #> 12: 2 2 2 #> 13: 3 2 1 #> 14: 4 2 1 #> 15: 5 2 2 #> 16: 6 2 3 #> 17: 7 2 1 #> 18: 8 2 2 #> 19: 9 2 3 #> 20: 10 2 3