I'm seeing this tutorial to know how to use LSTM to predict time series data and I noticed that he shifted the target/labels up so that the features are all in time t but the target is t+1

so my simple question is, should we always do this when working with time series data?

I have a time series data and I want to use it to build a regression model with RNN. I used feed forward NN first but it didn't work good enough so I decided to use RNN/LSTM. My question is should I let the dataset as it is now where every row have features and target at time t or should I shift the target column so that the features would always be at time t but the target is always shifted(t+1) ahead?


1 Answer 1


Yes, you are making prediction, which means using historical features(such as at time t) to predict the target in the future(say t+1). In many cases, you could use past few timestamps' features(say t-n,t-n+1,...t) to predict. Preprocess your data in the way (X_historical,y_future) in case of data leakage.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.