Splits data repeats (default: 30) times into training and test set with a ratio of ratio (default: 2/3) observations going into the training set.

Format

R6::R6Class inheriting from Resampling.

Construction

ResamplingSubsampling$new()
mlr_resamplings$get("subsampling")
rsmp("subsampling")

Fields

See Resampling.

Methods

See Resampling.

Parameters

  • repeats :: integer(1)
    Number of repetitions.

  • ratio :: numeric(1)
    Ratio of observations to put into the training set.

See also

Dictionary of Resamplings: mlr_resamplings

as.data.table(mlr_resamplings) for a complete table of all (also dynamically created) Resampling implementations.

Examples

# Create a task with 10 observations task = tsk("iris") task$filter(1:10) # Instantiate Resampling rss = rsmp("subsampling", repeats = 2, ratio = 0.5) rss$instantiate(task) # Individual sets: rss$train_set(1)
#> [1] 7 1 3 5 4
rss$test_set(1)
#> [1] 2 6 8 9 10
intersect(rss$train_set(1), rss$test_set(1))
#> integer(0)
# Internal storage: rss$instance$train # list of index vectors
#> [[1]] #> [1] 7 1 3 5 4 #> #> [[2]] #> [1] 7 10 4 3 6 #>