Splits data into a single training set and a test set. Parameter ratio determines the ratio of observation in the train set (default: 2/3).

ResamplingHoldout

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 rho = mlr_resamplings$get("holdout") rho$instantiate(task) # Individual sets: rho$train_set(1)
#> [1] 8 1 2 6 10 7 9
rho$test_set(1)
#> [1] 3 4 5
intersect(rho$train_set(1), rho$test_set(1))
#> integer(0)
# Internal storage: rho$instance # simple list
#> $train #> [1] 8 1 2 6 10 7 9 #> #> $test #> [1] 3 4 5 #>