Error using predictAndUpdateState (LSTM NN)
5 views (last 30 days)
Show older comments
Hello guys,
I am trying to conduct a regression analysis using a LSTM neural network.
I am using 8 variables as input, and obtaining 1 output.
My knowledge in Deep Learning Toolbox is limited, therefore I have used Neural Network Fitting App to create the network.
Once exported, I am trying to predict into the future using the function predictAndUpdateState. However, I keep getting the same error message:
% Xnew is a cell array with the 8 inputs I want to use to predict.
>> for i = 2:numTimeStepsTest
v = Xnew(:,i);
[net1,score] = predictAndUpdateState(net1,v);
scores(:,i) = score;
end
Undefined function 'predictAndUpdateState' for input arguments of type 'network'.
As I understand, a LSTM network is a recurrent neural network, therefore I don't know where the mistake could be.
As I said, my knowledge is very limited, so I would appreciate any help on this matter.
Many thanks,
Natalia
Answers (2)
Vineet Joshi
on 26 Oct 2021
Hi!
Background:
In the following code I have used the command line equivalent of 'Neural Network Fitting App' to create a simple network.
trainFcn = 'trainlm';
hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize,trainFcn);
class(net)
As you can see the 'fitnet' returns a network of type 'network'.
From the error shared by you, it looks like your case is same as well since input argument is of type 'network'.
Understanding the Error:
The documentation of predictAndUpdateState states that the input network can be of two types only. It can either be a SeriesNetwork object or a DAGNetwork object.
Possible Workaround:
The most strightforward workaround is to create a SeriesNetwork object or a DAGNetwork object. Attaching a few links to help you with this.
Helpful Links:
0 Comments
Pjeter Berisa
on 25 Oct 2022
I think the root problem is the same as discussed in this question:
0 Comments
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows 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!