Search code examples
pythonkerasrecurrent-neural-network

Multi dimensional input multi dimensional output rnn keras data preprocessing


I want to create a RNN model in Keras. In each time-step the input has 9 element and the output has 4 element.

input_size = (304414,9)
target_size = (304414,4)

How can I create a dataset of sliding windows over the time-series.


Solution

  • You can use this code by considering windows size and stride

    for idx in range(0, input.shape[0] - window_size - 1, stride):
            input.append(input_data[idx + 1: idx + 1 + window_size, :])
    
        input = np.reshape( input, (len(input), input[0].shape[0], input[0].shape[1]))