I have trained my time series NARX NN using 5*7875 inputs and 1*7875 target values. How do I make predictions for 5*10 new input values ?

1 view (last 30 days)
I have trained my time series NARX NN using 5*7875 inputs and 1*7875 target values. How do I make predictions for 5*10 new input values ?

Answers (1)

the cyclist
the cyclist on 29 Jul 2023
Edited: the cyclist on 30 Jul 2023
You don't describe the code you used in any detail, so it is not possible to be certain, but if you did something like what is described in this documentation page to build your NN, then you can build a closed-loop network with
[netc,Xic,Aic] = closeloop(net,Xf,Af);
and make predictions with that network using
Yc = netc(XPredict,Xic,Aic)
where XPredict stores your new input values.
If that page doesn't help you, I suggest your share your code. Expecting us to guess from a one-sentence description is not the most efficient way to get answers here.
  2 Comments
HABILA
HABILA on 30 Jul 2023
% Inputs - input time series.
% Target - feedback time series.
X = tonndata(Inputs,true,false);
T = tonndata(Target,true,false);
trainFcn = 'trainlm'; % Levenberg-Marquardt backpropagation.
% Create a Nonlinear Autoregressive Network with External Input
inputDelays = 1:2;
feedbackDelays = 1:2;
hiddenLayerSize = 10;
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize,'open',trainFcn);
[x,xi,ai,t] = preparets(net,X,{},T);
% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
% Train the Network
[net,tr] = train(net,x,t,xi,ai);
% Test the Network
y = net(x,xi,ai);
e = gsubtract(t,y);
performance = perform(net,t,y)
% View the Network
view(net)
% Plots
% Closed Loop Network
% Use this network to do multi-step prediction.
% The function CLOSELOOP replaces the feedback input with a direct
% connection from the output layer.
netc = closeloop(net);
netc.name = [net.name ' - Closed Loop'];
view(netc)
[xc,xic,aic,tc] = preparets(netc,X,{},T);
yc = netc(xc,xic,aic);
closedLoopPerformance = perform(net,tc,yc)
% Step-Ahead Prediction Network
nets = removedelay(net);
nets.name = [net.name ' - Predict One Step Ahead'];
view(nets)
[xs,xis,ais,ts] = preparets(nets,X,{},T);
ys = nets(xs,xis,ais);
stepAheadPerformance = perform(nets,ts,ys)
The above is my code where I have trained my NN. Now I want to predict output using new input data
the cyclist
the cyclist on 30 Jul 2023
According to the documentation (specifically the part I quoted in my answer), it looks like
prediction_for_new_input_data = netc(new_input_data,Xic,Aic)
does what you want.
I have not used this toolbox, so I am just quoting the documenation.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!