# Create a task with 10 observations
task = tsk("penguins")
task$filter(1:10)
# Instantiate Resampling
loo = rsmp("loo")
loo$instantiate(task)
# Individual sets:
loo$train_set(1)
loo$test_set(1)
# Disjunct sets:
intersect(loo$train_set(1), loo$test_set(1))
# Internal storage:
loo$instance # vector
# Combine with group feature of tasks:
task = tsk("penguins")
task$set_col_roles("island", add_to = "group")
loo$instantiate(task)
loo$iters # one fold for each level of "island"
Run the code above in your browser using DataLab