R/ResamplingRollingWindowCV.R
mlr_resamplings_RollingWindowCV.Rd
Splits data using a folds
-folds (default: 10 folds) rolling window cross-validation.
R6::R6Class inheriting from Resampling.
$new()
ResamplingRollingWindowCV::mlr_resamplings$get("ResamplingRollingWindowCV")
mlr3rsmp("ResamplingRollingWindowCV")
See Resampling.
See Resampling.
folds
:: integer(1)
Number of folds.
window_size
:: integer(1)
(Minimal) Size of the rolling window.
horizon
:: integer(1)
Forecasting horizon in the test sets.
fixed_window
:: logial(1)
Flag for fixed sized window. If FALSE an expanding window is used.
mlr3bischl_2012 paper:Ch. Bergmeir, R. J. Hyndman, B. Koo, A note on the validity of cross-validation for evaluating
Dictionary of Resamplings: mlr_resamplings
as.data.table(mlr_resamplings)
for a complete table of all (also dynamically created) Resampling implementations.
# Create a task with 10 observations
task = mlr3::tsk("airpassengers")
task$filter(1:20)
# Instantiate Resampling
rfho = mlr3::rsmp("RollingWindowCV", folds = 3, fixed_window = FALSE)
rfho$instantiate(task)
# Individual sets:
rfho$train_set(1)
#> [1] 1 2 3 4 5 6 7 8 9 10
rfho$test_set(1)
#> [1] 11 12 13 14 15
intersect(rfho$train_set(1), rfho$test_set(1))
#> integer(0)
# Internal storage:
rfho$instance # list
#> $train
#> $train[[1]]
#> [1] 1 2 3 4 5 6 7 8 9 10
#>
#> $train[[2]]
#> [1] 1 2 3 4 5 6 7 8 9 10 11 12 13
#>
#> $train[[3]]
#> [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#>
#>
#> $test
#> $test[[1]]
#> [1] 11 12 13 14 15
#>
#> $test[[2]]
#> [1] 14 15 16 17 18
#>
#> $test[[3]]
#> [1] 16 17 18 19 20
#>
#>