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
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)
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 个评论
另请参阅
类别
在 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!