How to k-fold cross validate with 3D continuous data?

604 views Asked by At

I'm training an LSTM network for timeseries regression using tensorflow. I've got 400+ data sets (3 inputs, 1 target) which I've sliced into 20 sample long windows. My training data is hence an and input and target numpy array of shape (no. of windows, window length, features). My code is as follows:

from sklearn.model_selection import StratifiedKFold
seed = 7
np.random.seed(seed)
kfold = StratifiedKFold(n_splits=10, shuffle=True, random_state=seed)
for train, test in kfold.split(input_train, target_train):
   #train model 

I'm aware that StratifiedKFold can't deal with 3D data, so my question is: how can I split my data using kfold cross validation when it has the shape it has?

Is it possible? Or am I misunderstanding how it works?

Any help is greatly appreciated!

Lucas

0

There are 0 answers