Error in predict function (LSTM NN trained in the Neural Net Fitting Toolbox)

3 次查看(过去 30 天)
Hello,
I have created a LSTM Neural Network in the Neural Net Fitting Toolbox, using 8 input variables.
The code that was generated and I exported is the following:
% Solve an Input-Output Fitting problem with a Neural Network
% Script generated by Neural Fitting app
% This script assumes these variables are defined:
% X - input data.
% yRecord - target data.
x = X';
t = yRecord';
% Choose a Training Function
% 'trainlm' is usually fastest.
% 'trainbr' takes longer but may be better for challenging problems.
% 'trainscg' uses less memory. Suitable in low memory situations.
trainFcn = 'trainbr'; % Bayesian Regularization backpropagation.
% Create a Fitting Network
hiddenLayerSize = 25;
net1 = fitnet(hiddenLayerSize,trainFcn);
% Choose Input and Output Pre/Post-Processing Functions
net1.input.processFcns = {'removeconstantrows','mapminmax'};
net1.output.processFcns = {'removeconstantrows','mapminmax'};
% Setup Division of Data for Training, Validation, Testing
net1.divideFcn = 'dividerand'; % Divide data randomly
net1.divideMode = 'sample'; % Divide up every sample
net1.divideParam.trainRatio = 70/100;
net1.divideParam.valRatio = 15/100;
net1.divideParam.testRatio = 15/100;
% Choose a Performance Function
net1.performFcn = 'mse'; % Mean Squared Error
% Choose Plot Functions
net1.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...
'plotregression', 'plotfit'};
% Train the Network
[net1,tr] = train(net1,x,t);
% Test the Network
y = net1(x);
e = gsubtract(t,y);
performance = perform(net1,t,y)
% Recalculate Training, Validation and Test Performance
trainTargets = t .* tr.trainMask{1};
valTargets = t .* tr.valMask{1};
testTargets = t .* tr.testMask{1};
trainPerformance = perform(net1,trainTargets,y)
valPerformance = perform(net1,valTargets,y)
testPerformance = perform(net1,testTargets,y)
% View the Network
view(net1)
I have exported the neural network into my workspace and now I would like to use it to predict some values into the future. I have tried to use the function predict but I keep getting the same mistake:
yPredtest = predict(net1,testingpred);
Error using predict (line 84)
No valid system or dataset was specified.
% testingpred is a matrix that contains the 8 input variables that I want to use
I have read the documentation and I don't find any proper solution, since I keep getting errors.
My knowledge in the Deep Learning Toolbox is limited, I would really appreciate if someone could provide a solution for this. I have been for some days trying several options and nothing has worked.
Many thanks,
Natalia

回答(0 个)

类别

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