I am looking for an R package, which allows me to do n-fold CV type hyper parameter optimisation (e.g. n = 10). Let us say this is the data I can used to tweak the hyper parameters (I tend to use rBayesianOptimization so let us abstract this away):
dates <- seq(as.Date('2017-01-01'), as.Date('2019-12-31'), by = 'days')
df <- data.frame(date = dates)
df$y <- 42
Here y, the dependent variable, is an obviously well known constant and it is just added here without being exploited.
I came across the caret function createTimeSlices and this would be a possible approach to split the data:
slices <- createTimeSlices(df$date, initialWindow = 365 * 2.5, horizon = 30, fixedWindow = TRUE)
I end up with a list like this:
List of 2
$ train:List of 153
..$ Training0912.5: int [1:912] 1 2 3 4 5 6 7 8 9 10 ...
..$ Training0913.5: int [1:912] 2 3 4 5 6 7 8 9 10 11 ...
...
..$ Training1010.5: int [1:912] 99 100 101 102 103 104 105 106 107 108 ...
.. [list output truncated]
$ test :List of 153
..$ Testing0912.5: num [1:30] 914 914 916 916 918 ...
..$ Testing0913.5: num [1:30] 914 916 916 918 918 ...
Can someone please point pout how to use this or refer me to another package? Personally, I am a bit confused about the training data indices only to shift 1 day (?). I would have thought it shifts 30 days (see horizon).
Thanks.