0
$\begingroup$

Suppose that I have a simple univariate time series. My goal is to use the value of 3 consecutive days to predict the value of the fourth day.

I built my dataset by applying a rolling window that moves forward along the time series by one day at a time.

enter image description here

The resulting dataset is structured as shown in this picture:

enter image description here

My question concerns the split into training and test set. Can I randomly sample this data set or do I risk data leakage? My understanding is that each sample is independent since there is no overlap in the values of each feature.

The alternative would be to split the initial time series in train and test portions, and then apply the rolling window separately to each set. My only issue with this approach is that the training set would not cover the whole time series, and as such it would not include some month-specific behavior of the target variable.

A walk-forward split could be another solution, but I'm afraid I don't have enough data point to implement it.

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.