Clear Filters
Clear Filters

Prooving a trained LSTM regression model

33 views (last 30 days)
James
James on 3 Jul 2024 at 11:57
Answered: Ayush Aniket on 8 Jul 2024 at 8:58
Hello
I am interested in proving how to derive the output given a new input value through the trained LSTM model.
I already know how to predict with new input data such as :
output = model.predict(input);
or
output = predict(model, input);
However, I am interested in a formula that uses the optimized variables of the trained LSTM (the variables shown in the figure below) to derive the results.
If you know what kind of calculation formula the output is derived when a new input value is given in LSTM, please help me.

Accepted Answer

Ayush Aniket
Ayush Aniket on 8 Jul 2024 at 8:58
Hi James,
To find the output using the weights of your trained layers, you will have to implement the equations for all the layers in your model. For the LSTM layer, refer this document section which shows the equations used to compute the output for each time step:
You would have to repeat the process for all the Fully Connected layers as well keeping in mind the size of input for the respective layers. Refer the following documentation section which provides the respective formulae:
Note: You will also have to take care of the pre and post processing functions that MATLAB layers implicitly apply to better train the neural network. The following MATLAB answer can guide you: https://www.mathworks.com/matlabcentral/answers/2068661-using-the-trained-lstm-weight-parameters-in-matlab-the-results-obtained-by-calculating-with-a-formu

More Answers (0)

Categories

Find more on Deep Learning Toolbox 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!