what does the function "predictAndUpdateState" in LSTM really do?

7 次查看(过去 30 天)
As described in the example "Time Series Forecasting Using Deep Learning", we can predict futher values based on the closer predicted results and repeat this process to accomplish long steps forcasting. But as shown in the following picture, why do we need to reset the trained net through "resetState", what states are reset in this process? And which states are updated through the function "predictAndUpdateState" ?does the net retrained to include the information of new predicted value? what is the difference if I use predict instead?
I am new to this field, bare with me if my description is unclear and confusing please.
I can understand using the predicted result as input to forcast further steps. My core confusion is that I don't understand how can you update the net which is already trained through large data and a long time through one new data and a short time('predictAndUpdateState' don't take much time), and what is updated in the process?
Thanks a lot for possible answers!

回答(1 个)

Abhinav Aravindan
Abhinav Aravindan 2024-12-12,12:23
Hi @Fred,
The “State” refers to the network state which is a table with three columns:
  • Layer – Layer name, specified as a string scalar.
  • Parameter – State parameter name, specified as a string scalar.
  • Value – Value of state parameter, specified as a dlarray object.
Layer states contain information calculated during the layer operation, which is retained for use in subsequent forward passes. In an LSTM network, the network state includes information remembered over all previous time steps.
The “resetState” function is used to reset these state parameters to their initial state. This is important because, during prediction and state updates, the updated state might negatively influence the output. By using “resetState” on a trained network, the learned parameters of the network are preserved, but the immediate context or sequence information is reset. This allows to evaluate the network performance on new sequences without the influence of prior predictions.
You may refer to the below post for the difference between the functionality of “predict” and “predictAndUpdateState”:
Please find the related documentation for further reference:

类别

Help CenterFile 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!

Translated by