MIMO NARX for multi-step ahead prediction

2 views (last 30 days)
Vinicius Prado
Vinicius Prado on 18 Aug 2020
Edited: Vinicius Prado on 18 Aug 2020
Hi there, I'm completely new to Matlab. I'm trying to implement a MIMO NARX for multi-step ahead prediction. This is what I got so far:
clear; clc; close all;
% Import data
[a,b,c] = xlsread('example.xlsx');
X = tonndata(a(:,(1:3)),false,false);
T = tonndata(a(:,(4:6)),false,false);
% Splitting the time series
N = 1000;
inputSeries = X(1:end-N);
targetSeries = T(1:end-N);
inputSeriesVal = X(end-N+1:end);
targetSeriesVal = T(end-N+1:end);
% NN architecture
delay = 100;
neuronsHiddenLayer = 10;
net = narxnet(1:delay,1:delay,neuronsHiddenLayer)
% NN training
[Xs,Xi,Ai,Ts] = preparets(net,inputSeries,{},targetSeries);
net = train(net,Xs,Ts,Xi,Ai);
view(net)
Y = net(Xs,Xi,Ai);
perf = perform(net,Ts,Y); % performance for one-step-ahead prediction
% 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);
view(netc)
figure;
plot([cell2mat(targetSeries),nan(1,N);
nan(1,length(targetSeries)),cell2mat(yPred);
nan(1,length(targetSeries)),cell2mat(targetSeriesVal)]')
legend('Original Targets','Network Predictions','Expected Outputs')
How do I verifiy all the results of the net? So far, only the first input and target are plotted after the training and testing of the net. Is it possible to define more hidden layers? Is it possible to define a different activation function for the output layer? Thank you.

Answers (0)

Categories

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

Tags

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!