MATLAB: About Neural Network

narxneural networks

When I use NARX neural work to make a prediction for a time series following the example in Matlab Help as follows,
'netp = removedelay(net); view(netp) [Xs,Xi,Ai,Ts] = preparets(netp,X,{},T); y = netp(Xs,Xi,Ai)'
The command of ‘preparets’ is used for prepare the input for the net. But by specifying the input X (external input), T (target), for 'preparets', the value of T should be already known before the prediction acutally conducted. What if the predicted value is unknown and the external input for the next time step is known, how to arrange the data to do the prediction then?
Thanks
Jun

Best Answer

You are slightly confused. T is a target used for training. It is not a prediction. It is what you want the output Y to be when X is the input.
The removedelay command plays no part in your question. All it does is reduce all delays by the same amount PROVIDED the resulting input delays remain nonnegative and the resulting feedback delays remain positive.
Otherwise an ERROR should result.
I think what you want to know is what happens if you want to predict the output beyond the time of the last known target value.
Similar to differential equations, what is needed is the extended input and the corresponding initial input and feedback delay states. The initial input and feedback delay states are just the final input and feedback delay states obtained from using the original data.
In particular, from the original data
[ Xs Ts Xi Ai ] = preparets( net, X, {}, T );
[ net tr Ys Es Xf Af ] = train( net, Xs, Ts, Xi, Ai );
where
[ Ys Xf Af ] = net( Xs, Xi, Ai );
To predict beyond this, you need to
1. Close the loop to feedback output instead of feeding back the target ( the target of the extended input is not known).
[ netc Xci Aci ] = closeloop( net, Xi, Ai );
2. Obtain the final input and feedback delay states
[ Xc Tc Xci Aci ] = preparets( netc, X, {}, T );
[ Yc Xcf Acf ] = netc( Xc, Xi, Aci );
3. Apply Xn = Xnew Xni = Xcf, Ani = Acj
[ Yn Xnf Anf ] = netc( Xn, Xni, Ani)
Hope this helps.
Thank you for formally accepting my answers
Greg