I am trying to use LSTM in Keras and I am not sure whether I should used statefull or stateless LSTM. I have read many resources online but seem like they do not apply to my case.

I have a long predictor series X=[X1,X2,....,Xn] and a long response series y=[0,0,...,1,1,0,...0]. They have the same length and the response can only take value 1 or 0. My plan is to subsample the long predictor series and use the short series (length 4) to predict the response for the next 3 time points. So my training data look look this


If I use all these short series (samples) available, I think I should choose stateful. However, because there are a lot more 0 in y compared to 1, I will keep all the samples that has 1 in the short response series (ex: keep this sample [y5=0,y6=1,y7=0]) but I will randomly drop a lot of other samples just to make the data balance.

I am not sure whether I should use stateful here, since some short series may be very far away from each other.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.