Borrar filtros
Borrar filtros

How can I make a t+10 prediction with NARX networks?

3 visualizaciones (últimos 30 días)
Fernando Grima Montesa
Fernando Grima Montesa el 20 de Dic. de 2021
Respondida: Samay Sagar el 24 de Mayo de 2024
Hi,
I am trying to make a t+10 step ahead prediction of sudden drop in solar radiation. My data base has minute steps time series of average solar radiation (in each minute), the largest derivative occurring at that minute, standard deviation of radiation and average of solar height.
I have already read the MATLAB NARX documentation and I am not sure about some concepts to know if I am working correctly with this kind of networks.
The MATLAB documentation states that to work with such networks it is best to train them in openloop mode and then close the loop to make step ahead predictions.
I don't know if it is necessary to make this prediction in closedloop mode in case the network needs to pre-calculate the steps t+1, t+2... until t+9 to calculate t+10 or just with openloop mode it could calculate that tenth step and have it at the current time with the current inputs (up to the step I have all actual inputs and outputs).
My output is a time series of zeros and ones when I consider that a big drop is starting, so I would want to predict if there is going to be any big drop in the next ten minutes ahead (or the probability of occurrence).
Am I applying well the concepts of this networks? In both cases (open and close loop) am I calculating t+10 with the exogenous 20 backwards?
Or does the network need the exogenous data in t+1, t+2 to make the tenth prediction?
Thank you in advance for your help.
delay = 10; %t+10 prediction
inputDelays = 11:20+delay;
feedbackDelays = 22:20+delay;
hiddenSizes=80;
net = narxnet(inputDelays,feedbackDelays,hiddenSizes,'open','trainlm');
net = removedelay(net,delay);
[Xo,Xi,Ai,To,shift] = preparets(net,X_train,{},Y_train);
net.divideFcn = 'divideblock';
net.divideParam.trainRatio = X;
net.divideParam.valRatio = Y;
net.divideParam.testRatio = Z;
net.trainParam.epochs = 60;
net.layers{2}.transferFcn = 'tansig';
%% Train network openloop mode
[net,info_net] = train(net,Xo,To,Xi,Ai);
%% Output openloop mode
[output_open,Xf,Af] = net(Xo,Xi,Ai);
errors = gsubtract(To,output_open);
Performance_values.perf_open = mse(net,To,output_open);
%% Output closeloop mode
net_closed = closeloop(net);
[Xc,xci,aci,Tc,shift2] = preparets(net_closed,X_test,{},Y_test);
[output_close,Xcc,acc]= net_closed(Xc,xci,aci);
Performance_values.perf_closed = mse(net,Tc,output_close);

Respuestas (1)

Samay Sagar
Samay Sagar el 24 de Mayo de 2024
For making multi-step-ahead predictions, the NARX network should be trained in open-loop mode. The training phase helps the network understand the patterns and dependencies in the time series. Then, the trained network should be converted to closed-loop mode. In closed-loop mode, the network uses its own previous outputs as inputs for future predictions, allowing it to generate a sequence of predictions up to the desired future time step. This is crucial for predicting t+10 since the network needs to predict the intermediate steps t+1 to t+9 first.
The approach to using NARX networks in the above code for time series prediction is correct. Setting up the network, training it in open-loop mode, and then switching to closed-loop mode for multi-step-ahead predictions is the proper procedure.
In open-loop mode, exogenous data up to the current time step is used to train the network. This helps the network learn the dependencies between inputs and outputs, whereas, in closed-loop mode, once the network is trained and switched to closed-loop, it uses its previous output as part of the input for the next prediction step. Thus, for predicting t+10, there is no need for exogenous data for each intermediate step (t+1 to t+9). The network uses its own previous predictions in these steps.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by