Narnet Forecast with removedelay and closeloop

2 views (last 30 days)
TargetSeries=input.';
N = length(TargetSeries);
zt = zscore(TargetSeries,1);
autocorrt = nncorr( zt, zt, N-1, 'biased' );
[ sortact FD ] = sort(autocorrt(N:end),2,'descend');
for i=1:length(sortact)
if(sortact(1,i)>=0.80)
feedbackDelay(1,i)=FD(1,i);
end
end
[max,maxInd] =findpeaks(autocorrt(N:end));
maxInd = maxInd(1,1:5);
DataInv = 1.01 - autocorrt(N:end);
[Minima,MinIdx] = findpeaks(DataInv);
MinIdx = MinIdx(1,1:5);
feedbackDelay = [feedbackDelay maxInd MinIdx];
feedbackDelay = sort(feedbackDelay);
net = narnet(feedbackDelay,10,'open',trainFcn);
[inputs,inputStates,layerStates,targets] = preparets(net,{},{},TargetSeries);
[net tr Ys Es Xf Af] = train(net,inputs,targets,inputStates,layerStates);
yPrediction = net(testdata,inputStates,layerStates);
predictMape is almost 3 and i have 10.000 data for this train and test.i wanna forecast 4000 step beyond time.Although I have also have this 4000 values,i behave like these don't exist.Totally i have 14000 values but i don't use last 4000.(I seperate this for forecast).
nets = removedelay(net);
for i=1:4000
[xs,xis,ais,ts] = preparets(nets,{},{},TargetSeries);
ys = nets(xs,xis,ais);
TargetSeries(1,end+1) = ys(1,end);
end
When i use removedelay,i get great result and my forecastMape is almost 10 for 4000 step but it takes 30 minutes it is huge time.
netc = closeloop(net);
[xc,xic,aic,tc] = preparets(netc,{},{},TargetSeries);
Xc2 = cell(1,4000);
Yc2 = netc( Xc2, xic, aic );
However when i use closeloop,i took bad result and my forecast mape is almost 90 but it takes 20 seconds.There is really huge difference between them.After 200 value ,it repeat itself.
I tried every thing.I change autocorrelation and i tried configure closeloop but i got nearly same result. I investigated narnet,closep loop tutorial,greg narnet and greg closeloop tutorial.How can i improve and getting good result in netc. Thank you.

Accepted Answer

Greg Heath
Greg Heath on 19 Apr 2016
Please revisit my calculations of significant lags.
1. abs(autocorrt) should be sorted
2. The significant correlation threshold should be estimated from noise statistics
3. Where is the function findpeaks?
4. your trainFcn is undefined
5. using removedelay yields a zero feedback delay which is invalid for the CL configuration.
6. What is predictMape?
Very hard to follow
Hope this helps.
Thank you for formally accepting my answer
Greg

More Answers (0)

Categories

Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!