LSTM time series forecasting with 3 inputs using chickenpox example
21 views (last 30 days)
Show older comments
Please let me know how to apply 3 inputs for the time series forecasting using LSTM example below.
chickenpox example link:
In this example, input is one(numFeatures = 1;) and I'm having trouble with changing the codes for the multiple inputs.
I'm not sure with the data input structures, and following codes for it.
It would be appreciate to provide the example or explanation about it.
Thank you.
6 Comments
Hanim Basarudin
on 7 Oct 2020
I think you have to use con2seq() to turn the multiple variables matrix into sequential vector like what Uros has described.
https://www.mathworks.com/help/deeplearning/ref/con2seq.html
Answers (1)
Jon Cherrie
on 2 May 2021
Rather than starting from the chickenpox example, you might be better off starting from the "Sequence-to-Sequence Regression Using Deep Learning" example:
In that case, the input is from 26 sensors and there is one output, an estimate of the remaining useful life of the engine.
5 Comments
mhd z
on 24 Nov 2021
Hello @Jon Cherrie
Thank you for this valuable example. As you mentioned in the example, the model gets one input of each and gives one output for each one of spicies.
- my question is that do they effect each other when the model is trained or when the data are forecasted? or the model just treats them as separate data and forecasts them? ( for example in stochastic models with exogenous serirs, the exogenous sesris help the model to model the original series more accurately. is it the same?)
- The other question is if I I want to model (forecast) only one of them, how should I change the code? is it possible at all? ( I tried to get help from the Turbofan Engine example, I tried to change some parts of this code by copying some of adjustments in the Turbofan exampple, but I was not successful. the code does throws an error in the training section. there is only 2 time series and there is no need to miniBatch. so, by changing only the number of features and responses in the layers and options, the code should work. but it didn't. I tried with miniBatch and it did not pass the training section.)
the questions might be silly and too long, but I would be very grateful if you answer, as much as you can.
Error using trainNetwork (line 183)
Number of elements must not change. Use [] as one of the size inputs to automatically calculate the appropriate size for that dimension.
Error in MultiVarLSTM_Pred_Ex_test (line 66)
net = trainNetwork(XTrain,YTrain,layers,options);
Caused by:
Error using reshape
Number of elements must not change. Use [] as one of the size inputs to automatically calculate the appropriate size for that dimension.
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!