What's the difference between NARX open loop + remove delay and closed loop to forecast N steps ahead?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm trying to forecast one day ahead (N = 24 steps) of a time series. In a previous work, I solved this problem by using an open loop (OL) NARX and removedelay function to shift my output (predicted value) 24 steps forward.
%%3. OL NARX Approach
%%3. Network Architecture
fh = 24; %Forecast Horizon
delay = 24;
inputDelays = fh:fh+delay;
feedbackDelays = fh:fh+delay;
neuronsHiddenLayer = 10;
% Network Creation
net = narxnet(inputDelays,feedbackDelays,neuronsHiddenLayer);
net = removedelay(net,fh);
%%4. Training the network
[Xs,Xi,Ai,Ts] = preparets(net,inputSeries,{},targetSeries);
net = train(net,Xs,Ts,Xi,Ai);
view(net)
% y(t+24)
Y = net(Xs,Xi,Ai);
% Performance for the series-parallel implementation, only
% one-step-ahead prediction
perf = perform(net,Ts,Y);
But now, by better searching the features of the toolbox, I noticed that people use NARX in closed loop (CL) to forecasting N steps ahead. More or less like the code below.
%%CL NARX Approach
%%2. Data Preparation
N = 24; % Multi-step ahead prediction
% Input and target series are divided in two groups of data:
% 1st group: used to train the network
inputSeries = X(1:end-N);
targetSeries = T(1:end-N);
% 2nd group: this is the new data used for simulation. inputSeriesVal will
% be used for predicting new targets. targetSeriesVal will be used for
% network validation after prediction
inputSeriesVal = X(end-N+1:end);
targetSeriesVal = T(end-N+1:end);
%%3. Network Architecture
delay = 24;
neuronsHiddenLayer = 10;
% Network Creation
net = narxnet(1:delay,1:delay,neuronsHiddenLayer);
%%4. Training the network
[Xs,Xi,Ai,Ts] = preparets(net,inputSeries,{},targetSeries);
net = train(net,Xs,Ts,Xi,Ai);
view(net)
Y = net(Xs,Xi,Ai);
% Performance for the series-parallel implementation, only
% one-step-ahead prediction
perf = perform(net,Ts,Y);
%%5. Multi-step ahead prediction
[Xs1,Xio,Aio] = preparets(net,inputSeries(1:end-delay),{},targetSeries(1:end-delay));
[Y1,Xfo,Afo] = net(Xs1,Xio,Aio);
[netc,Xic,Aic] = closeloop(net,Xfo,Afo);
[yPred,Xfc,Afc] = netc(inputSeriesVal,Xic,Aic);
multiStepPerformance = perform(net,yPred,targetSeriesVal);
- Was I using NARX in the wrong way?
- What is the difference between the two approaches?
Thanks for your attention.
0 Kommentare
Antworten (1)
Greg Heath
am 23 Sep. 2018
Open loop (OL) uses a priori target information to simulate output feedback. It is primarily used for design since the future output is not known
Close loop (CL) feeds back the actual output information, therefore unlike OL it is a real-time configuration.
Hope this helps.
Thank you for formally accepting my answer
Greg
0 Kommentare
Siehe auch
Kategorien
Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!