After you split your dataset into train and test, you need a create a data structure that looks like this:
Say, you have 10 rows in your dataset and you want to predict 1 value after looking at the previous 5 time steps.
1, 2, 3, 4, 5 -> 6
2, 3, 4, 5, 6 -> 7
3, 4, 5, 6, 7 -> 8
and so on…
So, X_train would be a numpy array:
[ [ 1, 2, 3, 4, 5],
[2 ,3, 4, 5, 6],
[3, 4, 5, 6, 7],
.
.
]
y_train would be a numpy array:
[5, 6, 7…]
Pass these into your RNN after converting this to tensors. Change shape as require by the rnn.
You can change your y_train to contain multiple numbers to predict multiple days into the future:
y_train:
[[5 , 6, 7],
[6, 7, 8],
[7, 8, 9]]
You’ll need to change the hidden_size argument in the rnn accordingly.