Azzera filtri
Azzera filtri

Time series prediction using NARX Net ( nnstart toolbox), can predictions be made without depending output after training has been done ?

5 visualizzazioni (ultimi 30 giorni)
so i have trained a narx net using nnnstart command, but there is a issure i a m facing that , it is predictiong output(Y_new) for new dataset only if we provide target output data(t_new) in preparets function , i.e to be excecuted just before making final prediction? on executing [Xs,Xi,Ai] = preparets(net,x_new,{}); , i am getting NaN for Y_new( predicted output) . but if i run [Xs_new,Xi_new,Ai_new,Ts] = preparets(net,x_new,{},t_new); , it is predicting , meanining it is dependent on target data. how to solve this issue? bcoz in reality we dont know target values that is why we are predicting ryt?
[net,tr] = train(net,Xs,Ts,Xi,Ai); % trained network using narxnet
[Xs,Xi,Ai] = preparets(net,x_new,{}); % prepare time series data - option 1 ( not working)
[Xs_new,Xi_new,Ai_new,Ts] = preparets(net,x_new,{},t_new); % prepare time series data - 2 ( working)
Y_new = net(Xs_new,Xi_new,Ai_new); % prediction on New Data set
  1 Commento
Thushar il 18 Mag 2024
below is the code for training using narx netowrk ( i have a non linear dataset) , can someone help me write the code for predicting for new data set using the trained nework net and final layer states? i have given many trials, but was unsuccesfull.
XTrain = tonndata(Predictors_train,false,false); % input for training
TTrain = tonndata(Responsers_train,false,false); % output for training
XPredict = tonndata(Predictors_test, false, false); % input for prediction ( new dataset for testing trainied network)
TTarget =tonndata(Responsers_test,false,false); % corresponding output -new dataset - (in reality it will be unkown)
net = narxnet(1:2,1:2,10);
% view(net);
[Xs,Xi,Ai,Ts] = preparets(net,XTrain,{},TTrain);
net = train(net,Xs,Ts,Xi,Ai);
[Y,Xf,Af] = net(Xs,Xi,Ai);
perf = perform(net,Ts,Y);
Y_mat = (cell2mat(Y))';
Ts_mat = (cell2mat(Ts))';
plot(Y_mat,'r', 'linewidth',1.2);
hold on;
%% Prediction on new data set using the trained network

Accedi per commentare.

Risposte (1)

Neha il 17 Mag 2024
Hi Thushar,
For a NARX network, during training, the network learns to predict the current target (t) based on past values of the target and past values of the inputs (x). This means the network inherently relies on having access to past target values during prediction as well.
When preparing your dataset, you can partition it into training data (XTrain and TTrain) for model training, and separate data (XPredict) for making predictions. Please refer to the following documentation link for more information on training a NARX Network and predicting on new data:
  1 Commento
Thushar il 18 Mag 2024
Thank you for your support :) , i tried the way you said but its working well till validation and for new data not some eror occuring ( NaN for predicted values) .

Accedi per commentare.


Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by