Cross validation with folds folds (default: 10).

ResamplingCV

Format

R6::R6Class inheriting from Resampling.

Examples

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