predictAndUpdateState function with multiple inputs in LSTM network (Sequence Regression)
2 次查看(过去 30 天)
显示 更早的评论
Dear Matlab community,
I am using LSTM network to predict the wind speed, I have multiple inputs and one output.
let's say 2 input and one output.
I understand the explanation of the predictAndUpdateState function as stated in the documentation but the problem is when I am using the function for predicting future values, as in the example of Time Series Forecasting Using Deep Learning (Closed Loop Forecasting)
https://ch.mathworks.com/help/deeplearning/ug/time-series-forecasting-using-deep-learning.html
it is not working, I got an error that the lstm layer expects 2 dimensions (2 features). but since I have one output, the result of the predictAndUpdateState function will be just one output.
can anyone please explain to me how to solve this problem
Thank you in advance
2 个评论
Gonzalo Postigo Omeñaca
2022-4-10
Dear all,
I am facing the same problem. As I have several inputs and one output, the input is not the delayed output (like we have in common time series problems). When I use [net,Ypred]=predictAndUpdateState(net,XTest) I am not updating the net with the real value "YTest", how could we update the net with the real output?
Thank you in advance.
Esther Hackenberg
2022-10-18
Hi, did anyone of you could solve the problem? I am facing the same. Many thanks for any advice.
回答(1 个)
Venu
2023-11-9
编辑:Venu
2023-11-9
I understand that you want to implement LSTM network to predict wind speed by giving multiple input features.
The error message you received suggests that there's a mismatch between the number of features in the LSTM layer and the input data used for prediction.
The problem you have described is not technically multiple-input RNN problems. This is because what we have is data that is described by multiple features - in the case of a single feature (and a single observation for simplicity), you would feed your RNN a 1 x T array, where T is the number of time-steps; in the case of multiple features, you would instead have a “numFeatures” x T array. However, in both those cases we still only have one input to our RNN, in the form of one array which contains all our data information.
One thing to remember is that different features of the input data don't equate to multiple inputs - instead, the data gets fed in N sequences at a time, where each sequence contains information for all the features in one big matrix (which is of size “numFeatures” x T).
The “predictAndUpdateState” function will output a single value, regardless of the number of input features. This depends on how many number of responses the LSTM network is designed to map the input features.
You can check with your “XTest()” dimensions (features x timestep), "numFeatures" and “numResponses” .
Please refer to this example: https://in.mathworks.com/help/deeplearning/ug/sequence-to-sequence-regression-using-deep-learning.html
Hope this helps!
Thanks
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!