Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to display the actual and predicted value of training dataset in NARX

Subject: How to display the actual and predicted value of training dataset in NARX

From: Arga Ridhalla

Date: 5 Feb, 2013 13:56:09

Message: 1 of 8

Hi all,
I'm a beginner in NN. I have dataset contain 8 time-series input variables and 1 time-series output variable (all of them are representing 60 timesteps). I want MATLAB to display all the actual value and predicted value that the NN trained it before. I also want MATLAB to display the future prediction of the output variable for 6 timesteps ahead. Please help me how to get that.

Thanks for the help!

Subject: How to display the actual and predicted value of training dataset in NARX

From: Greg Heath

Date: 7 Feb, 2013 12:25:08

Message: 2 of 8

"Arga Ridhalla" <arga.ridhalla@yahoo.co.id> wrote in message <ker31p$85u$1@newscl01ah.mathworks.com>...
> Hi all,
> I'm a beginner in NN. I have dataset contain 8 time-series input variables and 1 time-series output variable (all of them are representing 60 timesteps). I want MATLAB to display all the actual value and predicted value that the NN trained it before. I also want MATLAB to display the future prediction of the output variable for 6 timesteps ahead. Please help me how to get that.
>
> Thanks for the help!

Post your code so that we can help.

Greg

Subject: How to display the actual and predicted value of training dataset in NARX

From: Arga Ridhalla

Date: 7 Feb, 2013 15:50:11

Message: 3 of 8

"Greg Heath" <heath@alumni.brown.edu> wrote in message <kf06f4$bd7$1@newscl01ah.mathworks.com>...
> "Arga Ridhalla" <arga.ridhalla@yahoo.co.id> wrote in message <ker31p$85u$1@newscl01ah.mathworks.com>...
> > Hi all,
> > I'm a beginner in NN. I have dataset contain 8 time-series input variables and 1 time-series output variable (all of them are representing 60 timesteps). I want MATLAB to display all the actual value and predicted value that the NN trained it before. I also want MATLAB to display the future prediction of the output variable for 6 timesteps ahead. Please help me how to get that.
> >
> > Thanks for the help!
>
> Post your code so that we can help.
>
> Greg
Hi, Greg! Here's the code:

S=load('nanas Dataset full');
X=con2seq(S.S.nanasInputReducted);
T=con2seq(S.S.nanasTargetCopy);
% Create a Nonlinear Autoregressive Network with External Input
inputDelays = 12;
feedbackDelays = 12;
hiddenLayerSize = 10;
net = narxnet(1:inputDelays,1:feedbackDelays,hiddenLayerSize);
net.trainFcn='traingdm';
net.trainParam.epochs=10000;
net.trainParam.lr=1;
net.trainParam.mc=1;
net.trainParam.max_fail=100;
net.layers{1}.transferFcn ='logsig';

% Prepare the Data for Training and Simulation
[inputs,inputStates,layerStates,targets] = preparets(net,X,{},T);

% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;

% Train the Network
[net,tr] = train(net,inputs,targets,inputStates,layerStates);

Thanks for the help.

Subject: How to display the actual and predicted value of training dataset in NARX

From: Arga Ridhalla

Date: 11 Feb, 2013 15:40:10

Message: 4 of 8

"Arga Ridhalla" <arga.ridhalla@yahoo.co.id> wrote in message <kf0ifj$jd$1@newscl01ah.mathworks.com>...
> "Greg Heath" <heath@alumni.brown.edu> wrote in message <kf06f4$bd7$1@newscl01ah.mathworks.com>...
> > "Arga Ridhalla" <arga.ridhalla@yahoo.co.id> wrote in message <ker31p$85u$1@newscl01ah.mathworks.com>...
> > > Hi all,
> > > I'm a beginner in NN. I have dataset contain 8 time-series input variables and 1 time-series output variable (all of them are representing 60 timesteps). I want MATLAB to display all the actual value and predicted value that the NN trained it before. I also want MATLAB to display the future prediction of the output variable for 6 timesteps ahead. Please help me how to get that.
> > >
> > > Thanks for the help!
> >
> > Post your code so that we can help.
> >
> > Greg
> Hi, Greg! Here's the code:
>
> S=load('nanas Dataset full');
> X=con2seq(S.S.nanasInputReducted);
> T=con2seq(S.S.nanasTargetCopy);
> % Create a Nonlinear Autoregressive Network with External Input
> inputDelays = 12;
> feedbackDelays = 12;
> hiddenLayerSize = 10;
> net = narxnet(1:inputDelays,1:feedbackDelays,hiddenLayerSize);
> net.trainFcn='traingdm';
> net.trainParam.epochs=10000;
> net.trainParam.lr=1;
> net.trainParam.mc=1;
> net.trainParam.max_fail=100;
> net.layers{1}.transferFcn ='logsig';
>
> % Prepare the Data for Training and Simulation
> [inputs,inputStates,layerStates,targets] = preparets(net,X,{},T);
>
> % Setup Division of Data for Training, Validation, Testing
> net.divideParam.trainRatio = 70/100;
> net.divideParam.valRatio = 15/100;
> net.divideParam.testRatio = 15/100;
>
> % Train the Network
> [net,tr] = train(net,inputs,targets,inputStates,layerStates);
>
> Thanks for the help.

Please help me with this problem. I really need some answers or solutions for my final project at my college. Thanks :)

Subject: How to display the actual and predicted value of training dataset in NARX

From: Greg Heath

Date: 13 Feb, 2013 23:30:12

Message: 5 of 8

Subject: How to display the actual and predicted value of training dataset in NARX
From: Arga Ridhalla
Date: 7 Feb, 2013 15:50:11
Message: 3 of 4
"Greg Heath" <heath@alumni.brown.edu> wrote in message
<kf06f4$bd7$1@newscl01ah.mathworks.com>...
> "Arga Ridhalla" <arga.ridhalla@yahoo.co.id> wrote in message
<ker31p$85u$1@newscl01ah.mathworks.com>...
> > Hi all,
> > I'm a beginner in NN. I have dataset contain 8 time-series input variables and
1 time-series output variable (all of them are representing 60 timesteps). I want
MATLAB to display all the actual value and predicted value that the NN trained it
before. I also want MATLAB to display the future prediction of the output variable f
or 6 timesteps ahead. Please help me how to get that.
> >
> > Thanks for the help!
>
> Post your code so that we can help.
>
> Greg
Hi, Greg! Here's the code:
%
% S=load('nanas Dataset full');
% X=con2seq(S.S.nanasInputReducted);
% T=con2seq(S.S.nanasTargetCopy);
% % Create a Nonlinear Autoregressive Network with External Input
% inputDelays = 12;
% feedbackDelays = 12;

Why did you choose 12?
Did you look at the statistically significant lags of the autocorrelation of T
and crosscorrelation of X and T ?

% hiddenLayerSize = 10;
% net = narxnet(1:inputDelays,1:feedbackDelays,hiddenLayerSize);
% net.trainFcn='traingdm';
% net.trainParam.epochs=10000;
% net.trainParam.lr=1;
% net.trainParam.mc=1

Delete the last 4 commands and accept the narxnet defaults.

% net.trainParam.max_fail=100;

Delete: This is ~ a factor of 20 too high if you are going to use a
validation set for validation stopping. Accept the default of 6.

% net.layers{1}.transferFcn ='logsig';

Delete. Accept the default of 'tansig' which is more appropriate for
hidden layers.

% % Prepare the Data for Training and Simulation
% [inputs,inputStates,layerStates,targets] = preparets(net,X,{},T);

whos X T inputs inputStates layerStates targets

This will confirm if you have the correct dimensions

% % Setup Division of Data for Training, Validation, Testing
% net.divideParam.trainRatio = 70/100;
% net.divideParam.valRatio = 15/100;
% net.divideParam.testRatio = 15/100;

Delete. These are defaults.

However, you are accepting the default DIVIDERAND which
will destroy the correlations you need. Use DIVIDEBLOCK instead.

% % Train the Network
% [net,tr] = train(net,inputs,targets,inputStates,layerStates);

Look at

tr =tr

and choose what you want for outputs.

Hope this helps.

Greg

P.S. I search the newsgroup once or twice a day using "neural".
However, your post was never listed. I was looking for something
I wrote previously and searched using "greg". Only then did your
post appear. Otherwise I would have replied much sooner....
 Sorry

Subject: How to display the actual and predicted value of training dataset in NARX

From: Arga Ridhalla

Date: 16 Feb, 2013 00:36:08

Message: 6 of 8

"Greg Heath" <heath@alumni.brown.edu> wrote in message <kfh7m4$g55$1@newscl01ah.mathworks.com>...
> Subject: How to display the actual and predicted value of training dataset in NARX
> From: Arga Ridhalla
> Date: 7 Feb, 2013 15:50:11
> Message: 3 of 4
> "Greg Heath" <heath@alumni.brown.edu> wrote in message
> <kf06f4$bd7$1@newscl01ah.mathworks.com>...
> > "Arga Ridhalla" <arga.ridhalla@yahoo.co.id> wrote in message
> <ker31p$85u$1@newscl01ah.mathworks.com>...
> > > Hi all,
> > > I'm a beginner in NN. I have dataset contain 8 time-series input variables and
> 1 time-series output variable (all of them are representing 60 timesteps). I want
> MATLAB to display all the actual value and predicted value that the NN trained it
> before. I also want MATLAB to display the future prediction of the output variable f
> or 6 timesteps ahead. Please help me how to get that.
> > >
> > > Thanks for the help!
> >
> > Post your code so that we can help.
> >
> > Greg
> Hi, Greg! Here's the code:
> %
> % S=load('nanas Dataset full');
> % X=con2seq(S.S.nanasInputReducted);
> % T=con2seq(S.S.nanasTargetCopy);
> % % Create a Nonlinear Autoregressive Network with External Input
> % inputDelays = 12;
> % feedbackDelays = 12;
>
> Why did you choose 12?
> Did you look at the statistically significant lags of the autocorrelation of T
> and crosscorrelation of X and T ?
>
> % hiddenLayerSize = 10;
> % net = narxnet(1:inputDelays,1:feedbackDelays,hiddenLayerSize);
> % net.trainFcn='traingdm';
> % net.trainParam.epochs=10000;
> % net.trainParam.lr=1;
> % net.trainParam.mc=1
>
> Delete the last 4 commands and accept the narxnet defaults.
>
> % net.trainParam.max_fail=100;
>
> Delete: This is ~ a factor of 20 too high if you are going to use a
> validation set for validation stopping. Accept the default of 6.
>
> % net.layers{1}.transferFcn ='logsig';
>
> Delete. Accept the default of 'tansig' which is more appropriate for
> hidden layers.
>
> % % Prepare the Data for Training and Simulation
> % [inputs,inputStates,layerStates,targets] = preparets(net,X,{},T);
>
> whos X T inputs inputStates layerStates targets
>
> This will confirm if you have the correct dimensions
>
> % % Setup Division of Data for Training, Validation, Testing
> % net.divideParam.trainRatio = 70/100;
> % net.divideParam.valRatio = 15/100;
> % net.divideParam.testRatio = 15/100;
>
> Delete. These are defaults.
>
> However, you are accepting the default DIVIDERAND which
> will destroy the correlations you need. Use DIVIDEBLOCK instead.
>
> % % Train the Network
> % [net,tr] = train(net,inputs,targets,inputStates,layerStates);
>
> Look at
>
> tr =tr
>
> and choose what you want for outputs.
>
> Hope this helps.
>
> Greg
>
> P.S. I search the newsgroup once or twice a day using "neural".
> However, your post was never listed. I was looking for something
> I wrote previously and searched using "greg". Only then did your
> post appear. Otherwise I would have replied much sooner....
> Sorry

Hi Greg! Thanks for the answer. But I still have a question. I use dataset that representing 60 timestep from January 2008 to December 2012. Now, I want ANN to predict future value of the target for 6 timestep ahead (January 2013 to June 2013). I don't have any input variables that represent x(t) for Jan 2013 to June 2013. Is ANN able to do that prediction? How could I get that?

Thank you :)

Subject: How to display the actual and predicted value of training dataset in NARX

From: Greg Heath

Date: 17 Feb, 2013 02:16:05

Message: 7 of 8

"Arga Ridhalla" <arga.ridhalla@yahoo.co.id> wrote in message <kfmk9o$6op$1@newscl01ah.mathworks.com>...
> "Greg Heath" <heath@alumni.brown.edu> wrote in message <kfh7m4$g55$1@newscl01ah.mathworks.com>...
> > Subject: How to display the actual and predicted value of training dataset in NARX
> > From: Arga Ridhalla
> > Date: 7 Feb, 2013 15:50:11
> > Message: 3 of 4
> > "Greg Heath" <heath@alumni.brown.edu> wrote in message
> > <kf06f4$bd7$1@newscl01ah.mathworks.com>...
> > > "Arga Ridhalla" <arga.ridhalla@yahoo.co.id> wrote in message
> > <ker31p$85u$1@newscl01ah.mathworks.com>...
> > > > Hi all,
> > > > I'm a beginner in NN. I have dataset contain 8 time-series input variables and
> > 1 time-series output variable (all of them are representing 60 timesteps). I want
> > MATLAB to display all the actual value and predicted value that the NN trained it
> > before. I also want MATLAB to display the future prediction of the output variable f
> > or 6 timesteps ahead. Please help me how to get that.
> > > >
> > > > Thanks for the help!
> > >
> > > Post your code so that we can help.
> > >
> > > Greg
> > Hi, Greg! Here's the code:
> > %
> > % S=load('nanas Dataset full');
> > % X=con2seq(S.S.nanasInputReducted);
> > % T=con2seq(S.S.nanasTargetCopy);
> > % % Create a Nonlinear Autoregressive Network with External Input
> > % inputDelays = 12;
> > % feedbackDelays = 12;
> >
> > Why did you choose 12?
> > Did you look at the statistically significant lags of the autocorrelation of T
> > and crosscorrelation of X and T ?
> >
> > % hiddenLayerSize = 10;
> > % net = narxnet(1:inputDelays,1:feedbackDelays,hiddenLayerSize);
> > % net.trainFcn='traingdm';
> > % net.trainParam.epochs=10000;
> > % net.trainParam.lr=1;
> > % net.trainParam.mc=1
> >
> > Delete the last 4 commands and accept the narxnet defaults.
> >
> > % net.trainParam.max_fail=100;
> >
> > Delete: This is ~ a factor of 20 too high if you are going to use a
> > validation set for validation stopping. Accept the default of 6.
> >
> > % net.layers{1}.transferFcn ='logsig';
> >
> > Delete. Accept the default of 'tansig' which is more appropriate for
> > hidden layers.
> >
> > % % Prepare the Data for Training and Simulation
> > % [inputs,inputStates,layerStates,targets] = preparets(net,X,{},T);
> >
> > whos X T inputs inputStates layerStates targets
> >
> > This will confirm if you have the correct dimensions
> >
> > % % Setup Division of Data for Training, Validation, Testing
> > % net.divideParam.trainRatio = 70/100;
> > % net.divideParam.valRatio = 15/100;
> > % net.divideParam.testRatio = 15/100;
> >
> > Delete. These are defaults.
> >
> > However, you are accepting the default DIVIDERAND which
> > will destroy the correlations you need. Use DIVIDEBLOCK instead.
> >
> > % % Train the Network
> > % [net,tr] = train(net,inputs,targets,inputStates,layerStates);
> >
> > Look at
> >
> > tr =tr
> >
> > and choose what you want for outputs.
> >
> > Hope this helps.
> >
> > Greg
> >
> > P.S. I search the newsgroup once or twice a day using "neural".
> > However, your post was never listed. I was looking for something
> > I wrote previously and searched using "greg". Only then did your
> > post appear. Otherwise I would have replied much sooner....
> > Sorry
>
> Hi Greg! Thanks for the answer. But I still have a question. I use dataset that representing 60 timestep from January 2008 to December 2012. Now, I want ANN to predict future value of the target for 6 timestep ahead (January 2013 to June 2013). I don't have any input variables that represent x(t) for Jan 2013 to June 2013. Is ANN able to do that prediction? How could I get that?
>
> Thank you :)

Subject: How to display the actual and predicted value of training dataset in NARX

From: Greg Heath

Date: 17 Feb, 2013 16:24:06

Message: 8 of 8

"Greg Heath" <heath@alumni.brown.edu> wrote in message <kfpeh5$hb0$1@newscl01ah.mathworks.com>...
> "Arga Ridhalla" <arga.ridhalla@yahoo.co.id> wrote in message <kfmk9o$6op$1@newscl01ah.mathworks.com>...> > Hi Greg! Thanks for the answer. But I still have a question. I use dataset that representing 60 timestep from January 2008 to December 2012. Now, I want ANN to predict future value of the target for 6 timestep ahead (January 2013 to June 2013). I don't have any input variables that represent x(t) for Jan 2013 to June 2013. Is ANN able to do that prediction? How could I get that?
> >

With no input, use narnet.

Hope thid helps.

Greg

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us