NARXNET: Target Test Data needed for prediction... why?

9 views (last 30 days)
Hello,
why is the target data needed to make predictions using Narxnet. I find it a bit weird because I want predictions solely based on my Input data, I don't want the Network to "cheat" using target data to make predictions....
this is the way to make predictions using Narxnet:
[Xs1,Xio,Aio] = preparets(net,inputSeries,{},targetSeries);
[Y1,Xfo,Afo] = net(Xs1,Xio,Aio);
[netc,Xic,Aic] = closeloop(net,Xfo,Afo);
[yPred,Xfc,Afc] = netc(inputSeriesVal,Xic,Aic);
multiStepPerformance = perform(net,yPred,targetSeriesVal);
as you can see from the first line, the targetSeries is needed in preparets, without it the network can't make a prediction, why so? And does the network actually "cheat" using the targetSeries for its predictions?

Answers (1)

Hari
Hari on 16 Oct 2023
Hi ThomasP,
I understand that you have concerns about the use of target data in making predictions using “Narxnet. You want predictions solely based on your input data and are wondering why the target data is needed in the preparets function.
The target data is required in the preparets function of Narxnet because it is used for training and evaluating the network. In time series prediction, the network learns from the historical input-output patterns to make predictions for future data points.
The network does not "cheat" by using the target data for predictions. During training, the network adjusts its weights and biases based on the input-output pairs. Once trained, the network can make predictions based on the input data alone, without relying on the target data.
Here's an example to illustrate the process:
% Assuming you have already created and trained a Narxnet model 'net'
inputSeries = ...; % Historical input data
targetSeries = ...; % Corresponding target data
[Xs1, Xio, Aio] = preparets(net, inputSeries, {}, targetSeries);
[Y1, Xfo, Afo] = net(Xs1, Xio, Aio);
% The network is now trained and ready for predictions.
inputSeriesVal = ...; % New input data for prediction
[netc, Xic, Aic] = closeloop(net, Xfo, Afo);
% Use the trained closed-loop network to make predictions on the new input data using the netc function.
[yPred, Xfc, Afc] = netc(inputSeriesVal, Xic, Aic);
Refer to the documentation of “preparets” and “narxnet” for more information.
Hope this helps!

Community Treasure Hunt

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

Start Hunting!