Time series cross validation
Based on CrossValidated on StackOverflow
Proposed as cross-validation on a "rolling" basis.
The issue is that normally you have to randomly mix segments of your data, but in the case of time series this would completely destroy the temporal structure of your data.
What you instead do is define your folds as time windows that you "roll out" over your time series.
You train on the [0,t] data, then you make predictions for [t, t+n] . This will allow you to calculate an error value over the [t, t+n] values. Then you "roll out" your window to train on [0, t+n] and make predictions on [t, t+2*n], and so on.
The amount of folds is thus determined by how often "n" samples can be taken from the end of the initial training sample to the end of the series.
You use cross validation to optimize parameters, but it is important to take into account that smoothing parameters (e.g. in case of exponential smoothing) are often constrained. This means you need to choose a loss function that support constraints on model parameters, e.g. the "truncated Newton conjugate gradient".
Interesting question:
Isn't it the case that in this "cross-validation" schema