# Create a task with 10 observations
task = tsk("penguins")
task$filter(1:10)
# Instantiate Resampling:
custom_cv = rsmp("custom_cv")
f = factor(c(rep(letters[1:3], each = 3), NA))
custom_cv$instantiate(task, f = f)
custom_cv$iters # 3 folds
# Individual sets:
custom_cv$train_set(1)
custom_cv$test_set(1)
# Disjunct sets:
intersect(custom_cv$train_set(1), custom_cv$test_set(1))
Run the code above in your browser using DataLab