Since an LSTM RNN uses previous events to predict current sequences, why do we shuffle the training data? Don't we lose the temporal ordering of the training data? How is it still effective at making predictions after being trained on shuffled training data?
In general, when you shuffle the training data (a set of sequences), you shuffle the order in which sequences are fed to the RNN, you don't shuffle the ordering within individual sequences. This is fine to do when your network is stateless:
Stateless Case:
The network's memory only persists for the duration of a sequence. Training on sequence B before sequence A doesn't matter because the network's memory state does not persist across sequences.
On the other hand:
Stateful Case:
The network's memory persists across sequences. Here, you cannot blindly shuffle your data and expect optimal results. Sequence A should be fed to the network before sequence B because A comes before B, and we want the network to evaluate sequence B with memory of what was in sequence A.
LSTM
reset at each batch not sequence. So If you shuffle the sequence inside a batch you do loose the temporal context of each element. Let say I'm forecasting a stock price using a year of data with a sequence length of a day. How can the model learn long term relation (on the scale of week or months) if the sequence are randomly fed ? What would forecasting values for the "next" day mean in this context ? –
Vacillating © 2022 - 2024 — McMap. All rights reserved.