Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

CV and kfolds function for time series #60

Open
luboshanus opened this issue Nov 26, 2020 · 0 comments
Open

CV and kfolds function for time series #60

luboshanus opened this issue Nov 26, 2020 · 0 comments

Comments

@luboshanus
Copy link

Hi,
Is there any function to create indices as in kfolds() but having them not overlapping and moving from first to last?
I see two ways one would have it:

  1. K-folds and each fold partitioned: train/valid = 0.9/0.1, for instance,
  2. K-folds and train size = valid size, thus we need to split the data into K+1 folds

Example 1:
kfolds(1:50; k=5; partition=0.9) # something like this
train: [1:9],[11:19],[21:29],[31:39],[41:49]
valid: [10],[20],[30],[40],[50]

Example 2:
full-sample is 1:120, and 5-fold result considering equal train/valid sizes would look like
train: [1:20],[21:40],[41:60],[61:80],[81:100]
valid: [21:40],[41:60],[61:80],[81:100],[101:120]
I used 120 because of simpler imagination of splits.

Each example uses its observations for training once. In the first, we even don't use the validation observations to train on them. We might. Also, there can be the third example with expanding partitions, however, we would use first parts multiple time in validation and thus implicitly put more value on them in.

Thanks for comments.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant