predictAndUpdateState function with multiple inputs in LSTM network (Sequence Regression)

3 ビュー (過去 30 日間)
Mouhammad Jomaa Alkaseam
Mouhammad Jomaa Alkaseam 2022 年 3 月 31 日
編集済み: Venu 2023 年 11 月 9 日
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
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
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
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

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by