how can find the optimal delays and number of hidden nodes in narnet for forecasting task?

I have tried with these code but I haven't found solutions:
1/ Optimal timelags?
N = length(Target)
zy = zscore(Target,1);
autocorry = ifft( abs(fft(zy)).^2 )/N
%AUTOCORRELATION
ZT=zscore(Target,1);
autocorrT = nncorr(ZT,ZT,N-1,'biased')
figure(3)
plot(autocorrT)
%title('ACF')
2/Optimal hidden nodes???
%To find H
[I ,N]=size(Input);
[O ,N]=size(Target);
Neq=N*O;
Hub=floor((N-1)*O/(I+O+1)) %max H for Neq>=Nw
Thank you in advance.

7 Comments

Optimal hidden nodes???
I have 1413 observations: the targetseries size
trn/val/tst ratios = 0.8/0.10/0.10
ID = 0:2
Ntrneq = No. oftraining equations = prod(size(ttrn)) = Ntrn*O
where
[O ,Ntrn]=size(trainTarget);
O=1
and
Ntrn=(1413-2)*0.8= 1129
therefore
Ntrneq = Ntrn*O=1129*1=1129
and
Nw = No. of weights to be estimated
Nw = (MXFD*O +1 )*H + (H+1)*O
Nw = (10*1 +1 )*H + (H+1)*1 % is H =1413*0.8=1130??? and why we employed
MXFD=10???
Supposing that H=1130 and MXFD=10:
Nw = (10*1 +1 )*1130 + (1130+1)*1=13561
and the requirement Ntrneq > Nw yields the upper bound
Hub = -1 + ceil( (Ntrneq-O) / ( MXFD*O + O +1) )
Hub = -1 + ceil( (1129-1) / ( 10*1 + 1 +1) )=93
Hmax = floor(Hub/10)=9
As 9 the number of hidden nodes???
If your calculations are correct, I would perform my typical double loop search to find the smallest value of H <= 10 to give an acceptable solution.
By using Narxnet, if I found zero is the significant delays of the input-target cross correlation function how I must put the code:
inputDelays= [ ] ???????
can you help me by putting some code to determine inputDelays in narx.
thanks
we can use:
cor_seq=xcorr(X,T)% X is input and Y is the target
after, we can plot the cor_seq vs lags and we can find the lag which can define the symmetric part of the plot?????
Is right??????
Why are you posting questions about NARXNET in a NARNET thread ?
Search the NEWSGROUP and ANSWERS
NEWSGROUP ANSWERS
narxnet nncorr 7 42
narxnet xcorr 2 8
narxnet fft 1 13
Read the most recent NEWSGROUP posts first.
I searched the NEWSGROUP threads listed above. Only the "narxnet nncorr" search was fruitfull. Of the 7 threads, only 3 were useful. However, 8 messages in those threads are useful:
1. Subject: SIGNIFICANT AUTOCORRELATION DELAYS OF THE SIMPLENAR_DATASET
Date: 31 May, 2015
Messages: 12, 15, 19, 23
2. Subject: NARNET TUTORIAL ON MULTISTEP AHEAD PREDICTIONS
Date: 17 Dec, 2014
Messages: 1 , 7, 11
3. Subject: open-loop to closed-loop Narx NN in Matlab Help
Date: 21 Oct, 2012
Message: 4
Hope this helps.
Greg

Sign in to comment.

 Accepted Answer

I have many posts regarding this.
Search both the NEWSGROUP and ANSWERS using subsets of the following search words
greg narnet nncorr siglag95 Hub Ntrials tutorial
Hope this helps.
Greg

4 Comments

Thank you Greg,
By using narxnet, I have found that the input/target crosscorrelation function is symmetric about zero lag. how I can put the code of the inputDelay.
Thank you.
NARXNET???
I think you mean NNCORR ...right?
Crosscorrelation functions are not symmetric. That is a NNCORR BUG.
Use the nonnegative lag portion.
Use the smallest subset of significant lags that will yield sufficient results. It is a trial and error process.
Which of my posts are you following?
NEWSGROUP:
ANSWERS:
Thanks Greg. We can not use this:
cor_seq=xcorr(X,T)% X is input and Y is the target
after, we can plot the cor_seq vs lags and we can find the lag which can define the symmetric part of the plot?????
Is right??????
No.
1. Find all NONNEGATIVE lags where the absolute value of the input/target crosscorrelation function exceeds a specified threshold.
2. For a threshold I use an estimate of the 95 per cent significance level of Gaussian noise.
3. Then choose a subset of the smallest significant lags to include in the design. For example, if the smallest significant input lags are 0 2 3 6 8, using ID = 0:3 might be a reasonable first try.
4. Similarly for the target autocorrelation function and significant feedback lags EXCEPT, the feedback lags must be POSITIVE.
5. Finally, given the choice of delays, use the double for loop (h = Hmin:dH:Hmax, i = 1:Ntrials) approach to determine the smallest number of hidden nodes that yields either an acceptable, or the best design.
Hope this helps.
Greg

Sign in to comment.

More Answers (0)

Asked:

on 19 Jul 2014

Commented:

on 12 Oct 2015

Community Treasure Hunt

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

Start Hunting!