# 2 basic doubts on time series

Suppose say, I have to predict the cost of stock market. I have previous data and I have made it into the following Structure :

(Xt-3,Xt-2,Xt-1)--->(Xt=Yt)

Now the order of the above data points if I use an LSTM model should be preserved which means the Day1, Day2 and Day3 should be in sequential order.

My doubt is I will be having different rows like this. Can I shuffle those for training while preserving the order within each row. Eg : Can I keep the row For 3 days of August before 3 days of July even though those 3 days will be given in sequential order. I am assuming we should as every models considers each data row as a separate training sample and adjusts its weights as per gradient descent so order should not matter even if we shuffle the rows. Am I right?

Second doubt : if I have trained my model till May 8, And I need to predict tomorrow (May 11) and my window length is 3 for LSTM

Should I predict May 9 and May 10 and then use May 8, may 9 and May 10 value to predict the next day or should I use actual values of May 9 and May 10. I read somewhere you need to retrain to make new forecast. But I dont think it's a compulsion. If I have trained my model till may 8 and then I give it the values of May 8 May 9 and May10 in sequential order, It should give me a forecast right?

• With regards to rows, you'd set stateful=False in Tensorflow. Not sure equivalent in PyTorch. But then the state for each row is not kept, thereby the order of rows isn't needed. May 10 at 16:46