Cross validation with folds folds (cv: 10 folds, cv3: 3 folds).

ResamplingCV

Format

R6::R6Class inheriting from Resampling.

Fields

See Resampling.

Methods

See 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] 2 3 8 5 7 10
rcv$test_set(1)
#> [1] 1 4 6 9
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: 6 1 #> 4: 9 1 #> 5: 2 2 #> 6: 3 2 #> 7: 8 2 #> 8: 5 3 #> 9: 7 3 #> 10: 10 3