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!