How to use narxnet for new set of data?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sam136
el 24 de Ag. de 2014
Comentada: abhilasha singh
el 21 de Jun. de 2021
I trained a narxnet network with 4 inputs and 2 targets for system identification. The training performance (RMS) seems pretty good, but the problem is that I don't know how to use this net for new set of data. According to the Matlab Help, I should use closed loop form (netc) for doing this:
netc = closeloop(net);
view(netc);
[Xs,Xi,Ai,Ts] = preparets(netc,X,{},T);
y = netc(Xs,Xi,Ai);
In this process, the target value (T) is required which doesn't make sense because target is not available for system identification. How should I use this network for new set of input data while I don't have target values?
2 comentarios
abhilasha singh
el 21 de Jun. de 2021
i also have the same problem .I even tried with taking intial targets as 'ones' but still the prediction is wrong.Please someone suggest the solution to evaluate NARX using new input sequence.
Respuesta aceptada
Greg Heath
el 28 de Ag. de 2014
1. The best way to solve a problem is to use the MATLAB example data with which we are familiar
help nndata
2. It doesn't make sense to guess at what the delays should be. Find the statistically significant feedback delays indicated by the target autocorrelation function and the statistically significant input delays indicated by the input/target crosscorrelation function. If you don't have a correlation function algorithm in another toolbox use nncorr. However, it has a bug that yields symmetric crosscorrelations. Therefore you have to combine nncorr(x,t...) with nncorr(t,x,...) as illustrated in many of my posts. Search using
greg narxnet nncorr
3. It doesn't make sense to use the default datadivision setting 'dividerand' because it ruins the correlations found above. Use either 'divideblock' or 'divideind'.
4. Use as few hidden nodes as possible. I typically design 10 nets for each trial value of H less than the upperbound Hub that is determined using the number of weights used (including) delays.
5. See what I wrote previously re (a)retraining, (b) Using Xf,Af for new data.
Greg
4 comentarios
Gabriel Theberge
el 1 de Mayo de 2016
Editada: Gabriel Theberge
el 1 de Mayo de 2016
Hi Greg H. In this last reply, you clarified a lot of things that I know are misunderstood by most of Matlab NARX users. From what I understand now, a well trained NARX model cannot be used in "openloop form" to generate prediction, even for ONE STEP AHEAD prediction, am I correct?
A lot of your comments should be added to the MATLAB documentation with NN Toolbox because a lot of details are not clear at all in this documentation. The proof is in the number of users that asks questions about the subject. Even if it's clear that we must use "close-loop form" for multi-step predictions on new data, I thought I could make one prediction (the very next step of the Y time series) in the close-loop form. But from what you said, It seems that even for one step, we need close loop and the feedback delay buffer. I think this is what is called :
Pf = Final input delay conditions
Af = Final layer delay conditions
from [net,tr,Y,E,Pf,Af] = train(net,P,T,Pi,Ai)
in the Matlab documentation of train function.
Muhammad Adil Raja
el 16 de Mzo. de 2020
Thanks Greg for your response. I find it quite useful. I have a concern though about using preparets for preparing data for testing an open loop or closed loop network. What if we are doing a blind test in which we do not have target values to test a network. How will preparets prepare data in that case, especially layer states, which, presumably, it prepares with the help of target data. Absense of target data messes up the whole network like this. I wonder what is a workaround for this please!
Más respuestas (2)
Greg Heath
el 25 de Ag. de 2014
1. Test netc with the original data. If performance is lousy, train it starting with the existing weights from the openloop design and the original data.
2. Use the form
[net tr Ys Es Xf Af ] = train(netc,Xs,Ts,Xi,Ai);
to get Xf and Af which will become Xi and Ai for the new input data.
3 For more examples search
greg narxnet
Hope this helps.
Thank you for formally accepting my answer
Greg
4 comentarios
Greg Heath
el 30 de Ag. de 2014
Openloop narxnet is a design step, not a deployable net. Openloop requires an additional input which contains target data. See the diagram obtained via the commands
view(net)
view(netc)
Back to essentials:
1. You did not use nncorr to determine the statistically significant input and feedback delays. 2. You did not overwite the dividerand default. Therefore a. the correlations between output and delayed input and feedback are probably severely compromised. b. You didn't realize train automatically divides the data into random training, validation and test subsets.
I am surprised your training turned out pretty good. How much of the mean target variance is explained be your model?
There are so many problems that I can only refer you to my posts.
greg narxnet closeloop
Sam136
el 4 de Sept. de 2014
Editada: Sam136
el 4 de Sept. de 2014
1 comentario
Greg Heath
el 5 de Sept. de 2014
I don't see any coding errors.
Suggestions
1. Choose ID using target/input cross-correlation function and FD using target autocorrelation function
greg narxnet nncorr
2. Choose H by trial and error
for h = Hmin:dH:Hmax
3. Choose initial random weights by trial and error
for i = 1:Ntrials
I have posted many examples
Ver también
Categorías
Más información sobre Modeling and Prediction with NARX and Time-Delay Networks en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!