Test trained NARX neural network with new external input

I have a time series NARX neural network that is already trained on an external input, x(t), as well as the output's value at certain timesteps before (d past values of y(t)). The network architecture is illustrated in the document I've uploaded.
Now I would like to take the trained network, input a new external input x(t), and get a time series prediction output. To prepare the inputs for getting the outputs I would need to use preparets to get the correct form of x(t), inputStates and layerStates, but it seems from the documentation that a target series is required for this. Since this is a test, I don't have a target series, what should I do?
Furthermore, since I have no clue what the output y(t) would be (since this a test), would it make sense for me to remove all feedback (past values of y(t)) into the hidden layers?
Thanks,
Mei

 채택된 답변

Greg Heath
Greg Heath 2013년 10월 16일

0 개 추천

If the new data immediately follows the data used to design and test the net, the following syntax should have been used
[ net tr Ys Es Xsf Asf ] = train(net,Xs,Ts,Xi,Ai);
Xinew = Xsf; Ainew = Asf;
Ysnew = net(Xsnew,Xinew,Ainew);
Otherwise
Xinew = Xnew(:,1:d); Xsnew = Xnew(:,d+1:end)
but Ainew is not known.
I would try the mean of the previously used test target data rather than use zeros. Perhaps several designs using values in the interval [mean-stdv,mean+stdv] would be useful.
Hope this helps.
Thank you for formally accepting my answer
Greg

댓글 수: 1

Tim
Tim 2015년 8월 1일
편집: Tim 2015년 8월 1일
Hey Greg, sorry I still don't get it. The inputs of the net() function to predict values are:
-XsNew: I think this is the new, unseen data. This data consists of a cell array with two rows. Row two contains the classlabels. BUT I dont know them !? How can I understand this?
I give you an example of what I mean:
  1. Item one
  2. Item twoLoading the training classifier (NARX) with closed loop => netc
  3. 2. New data (feature Values) from a time series comes in
  4. 3. netc(A,B,C)with
  • Item one
  • Item twoA: Cell Array with two rows: ROW1: Feature Values (thats ok); ROW2: Class Values (????? How should I know them)
Here is my problem with your
Xinew = Xnew(:,1:d); Xsnew = Xnew(:,d+1:end)
explanation. I need the information about the classees, otherwise there are not enough inputs (the dimension does not match)
Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

mehdi asgharzadeh
mehdi asgharzadeh 2021년 2월 8일

1 개 추천

I honestly dont think these poor MATLAB guys know what they are talking about here. As everyone esle has pointed out, we don't have the output target array when we are in pridicting mode (closed loop). Training is OK but predicting this way only works when you have future values of exogenous time series but not the target itself (for some reasons) and want to estimate them. If you are trying to predict stock's future values and things like that, sorry this is not going to help you.

댓글 수: 2

so What is the procedure to predict from pretrained neural network.I have trained one now what is the approriate way to genrate prediction from that network.Thanks
Philipp John
Philipp John 2021년 10월 21일
편집: Philipp John 2021년 10월 21일
This article helped me, to understand how to make a prediction from a trained NARXnet: https://towardsdatascience.com/building-a-narx-in-matlab-to-forecast-time-series-data-f60561864874
In this article you find a Tutorial on how to train a NARXnet and how to forecast time series data with it. There is also a link to the csv data, which he used for training and prediction.
Maybe it also helps you

댓글을 달려면 로그인하십시오.

Jonathan LeSage
Jonathan LeSage 2013년 10월 15일

0 개 추천

Here is an example from the Neural Network toolbox documentation that you might find helpful:
To simulate an output from your NARX neural network, you need both the initial input delay states and the initial layer delay states. The preparets helps to simplify this task. You can use the inputs and outputs that you are training your neural network model with to get you started. Additional useful documentation:
In the second link above, you might find the section, entitled "Simulate NARX Time Series Networks", useful as well.
Hope this helps to get you started!

댓글 수: 4

Mei
Mei 2013년 10월 15일
편집: Mei 2013년 10월 15일
In all of the documentation/examples, the NARX is tested on the same exogenous input it is trained on.
In my case, I have a completely different set of exogenous inputs (but in the same format as when the NARX network was trained of course) that I would like to test.
I attempted to take the trained NARX network and remove all the feedback connections and retain all the layer and input weights calculated from the previous training. Effectively I now have a input-output network with layer and input weights from before. I then put in the new exogenous inputs, but it didn't work - all the predictions are one and the same (0.5 at all timepoints).
This is what I did:
inputSeries = UsableConcs_Ternary; % My new exogenous input
neto = net; % net is the previously trained neural network (with feedback into both hidden layers as well as a different set of exogenous inputs)
neto.layerConnect=[false false false; true false false; false true false]; % I removed the feedback connections since I don't have a target series for this new set of exogenous inputs anyway (I want to simulate,not train)
view(neto)
[xc,xic,aic,~,~,shift] = preparets(neto,inputSeries,{}); % Again, I don't have a target series here and preparets seems to require it yc = neto(xc,xic,aic); % Simulate the trained neural network without feedback
Russell Grm
Russell Grm 2019년 1월 31일
편집: Greg Heath 2019년 1월 31일
Hi everyone,
This question has been left unanswered for so long and so the discussion is sill open. Could any expert please prvide a proper answer or piece of code that would assisst us?
Thanks in advance,
What EXACTLY do you not understand ?
What EXACTLY do you want to do ?
I do not understand what I have written is not perfectly clear.
Greg
Hi,
I have a similar problem. I used the nn toolbox to train a NARX neural network. I want my network to predict the output at the next time interval. Lets take the well know example of the magnetic leviation from matlab. For this example we have one input (current) and one output (leviated magnetic position). I want to deploy the trained network such that when I give in the input (current) and the delayed input and output states, it should give me the output (leviated magnetic position) at the next time interval.
But when I deploy my network using the toolbox, it generates a function with different input arguments like,
x1 input 1: from my understanding this is the input to our system (current in out case)
x2 input 2: from my understanding this is the output to our system (we only have one input, so what is this???)
xi1 delayed input state
xi2 delayed output state
What I don't understand is, what exactly is x2? Why should I give the output? I don't have this output, that is why I am using the network to predict the output.
Thank you!

댓글을 달려면 로그인하십시오.

Mohsen Zabihi
Mohsen Zabihi 2016년 4월 21일
편집: Mohsen Zabihi 2016년 4월 21일

0 개 추천

I have the same question. anyone can help?

댓글 수: 3

MATLAB has fundamental errors in their NARX implementation, despite the commentary by GH. I will ask their developers about it immediately.
In the documentation MAGLEV example on forecasting, i adjusted a single target state that was not to be used as an input since it is considered unknown. the prediction immediately went unstable.
Did you figured something out?
I have a simple SISO system. It work's well when i train the network directly in closed loop and then simulate on new unseen input data. But when i want to train it in open-loop as intended and simulate in closed loop form, it went unstable.
Hi, I have the same issue discussed here but still don't get solution, please how do you test your narx nn only with new input since it requiers a target while doing the preparets

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

질문:

Mei
2013년 10월 15일

편집:

2021년 10월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by