I have a time series like:
index date id value
0 d1 a 10
1 d2 a 15
2 d2 b 20
3 d3 a 18
4 d3 b 19
5 d4 b 21
6 d4 c 25
I want to do a time series split, so the splits would be:
train_1 = index[0], test_1 = index[1, 2]
train_2 = index[0, 1, 2], test_2 = index[3, 4]
and so on...
Is there a simple way so I can implement on a cross-validation, like:
for train_idx, test_idx in split_indexes:
model.fit(X.iloc[train_idx], y_tr.iloc[train_idx])
...