Using NARX model with Neural Network Prediction
Mostrar comentarios más antiguos
Hello,
Im doing a carbon emission(output) with multiple input using neural network approached (NARX). I trained the model using NARX tollbox. I couldn't find the code I needed to write to predict the next 5 years.
Can you help me?
1 comentario
Seda
el 10 de Nov. de 2023
Respuestas (1)
Venu
el 29 de Nov. de 2023
1 voto
I understand you want to predict next 5 years output. For that we need to know format of your input time series dataset. For example you have the data of 10 months, 1 month will be the predicted output time series since your test data is 1/10th. So you need to predict for next 60 months i.e 5 years.
You can find the below example code as reference which is like extention to your code.
% Number of future time steps to predict
numFutureSteps = 60; % 5 years of monthly predictions
% cell array for the predicted values
predictedValues = cell(1, numFutureSteps);
% Initialize the prediction loop state with the last values of the input and layer states
[~, lastInputState, lastLayerState] = preparets(netc, X, {}, T);
lastOutput = yc{end}; % last predicted output from the closed loop network
% predict into the future, one step at a time
for i = 1:numFutureSteps
% use the last predicted output as the current input for the prediction
[nextOutput, nextInputState, nextLayerState] = netc({lastOutput}, lastInputState, lastLayerState);
% store the predicted value
predictedValues{i} = nextOutput;
% Update the last output and states for the next iteration
lastOutput = nextOutput;
lastInputState = nextInputState;
lastLayerState = nextLayerState;
end
% The predictedValues cell array now contains your 5-year predictions
Categorías
Más información sobre Deep Learning Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!