Error using predictAndUpdateState (LSTM NN)

5 次查看(过去 30 天)
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

回答(2 个)

Vineet Joshi
Vineet Joshi 2021-10-26
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)
ans = 'network'
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:

Pjeter Berisa
Pjeter Berisa 2022-10-25

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by