LSTM Multiple Independent Input Time Series - Data Preprocessing
Given a single univariate time series of complexity say 5, look-back of 2 and forecast of 1 the generated samples would be:
- TS = [ 1 , 2 , 3 , 4 , 5 ]
- xTrain = [ [1,2] , [2,3] , [3,4] ] that gets reshaped to dimensions [ 3 , 2 , 1 ]
- yTrain = [ 3 , 4 , 5 ]
My question is what if 2 or more univariate time series were provided, how should I form my data then?
Will provide an example to describe my approach :
- Look-back = 2 and forecast = 1
- TS-1 = [ 1 , 2 , 3 , 4 , 5 ]
- TS-2 = [ 10 , 20 , 30 , 40 , 50 ]
- xTrain = [ [1,2] , [2,3] , [3,4] , [10,20] , [20,30] , [30,40] ] that gets reshaped to dimensions [ 6 , 2 , 1 ]
- yTrain = [ 3 , 4 , 5 , 30 , 40 , 50 ]
Would this work?
My dataset consists of 100 independent univariate time series - specifically stock prices for 60 days - and I was assigned to train my model on a set of them say 60 and test/predict the remaining 40. My first approach was to follow the first example and call the model.fit(xTrain,yTrain)
60 times for each time series but I don't know if this works as expected on the tensorflow.keras.model
and I don't think it works with the set requirement
Edit : Each of the predictions should happen one at a time
Topic lstm keras tensorflow
Category Data Science