http://www.mathworks.com/matlabcentral/newsreader/view_thread/326484
MATLAB Central Newsreader  How to display the actual and predicted value of training dataset in NARX
Feed for thread: How to display the actual and predicted value of training dataset in NARX
enus
©19942014 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Tue, 05 Feb 2013 13:56:09 +0000
How to display the actual and predicted value of training dataset in NARX
http://www.mathworks.com/matlabcentral/newsreader/view_thread/326484#897159
Arga Ridhalla
Hi all,<br>
I'm a beginner in NN. I have dataset contain 8 timeseries input variables and 1 timeseries 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. <br>
<br>
Thanks for the help!

Thu, 07 Feb 2013 12:25:08 +0000
Re: How to display the actual and predicted value of training dataset in NARX
http://www.mathworks.com/matlabcentral/newsreader/view_thread/326484#897391
Greg Heath
"Arga Ridhalla" <arga.ridhalla@yahoo.co.id> wrote in message <ker31p$85u$1@newscl01ah.mathworks.com>...<br>
> Hi all,<br>
> I'm a beginner in NN. I have dataset contain 8 timeseries input variables and 1 timeseries 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. <br>
> <br>
> Thanks for the help!<br>
<br>
Post your code so that we can help.<br>
<br>
Greg

Thu, 07 Feb 2013 15:50:11 +0000
Re: How to display the actual and predicted value of training dataset in NARX
http://www.mathworks.com/matlabcentral/newsreader/view_thread/326484#897421
Arga Ridhalla
"Greg Heath" <heath@alumni.brown.edu> wrote in message <kf06f4$bd7$1@newscl01ah.mathworks.com>...<br>
> "Arga Ridhalla" <arga.ridhalla@yahoo.co.id> wrote in message <ker31p$85u$1@newscl01ah.mathworks.com>...<br>
> > Hi all,<br>
> > I'm a beginner in NN. I have dataset contain 8 timeseries input variables and 1 timeseries 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. <br>
> > <br>
> > Thanks for the help!<br>
> <br>
> Post your code so that we can help.<br>
> <br>
> Greg<br>
Hi, Greg! Here's the code:<br>
<br>
S=load('nanas Dataset full');<br>
X=con2seq(S.S.nanasInputReducted);<br>
T=con2seq(S.S.nanasTargetCopy);<br>
% Create a Nonlinear Autoregressive Network with External Input<br>
inputDelays = 12;<br>
feedbackDelays = 12;<br>
hiddenLayerSize = 10;<br>
net = narxnet(1:inputDelays,1:feedbackDelays,hiddenLayerSize);<br>
net.trainFcn='traingdm';<br>
net.trainParam.epochs=10000;<br>
net.trainParam.lr=1;<br>
net.trainParam.mc=1;<br>
net.trainParam.max_fail=100;<br>
net.layers{1}.transferFcn ='logsig';<br>
<br>
% Prepare the Data for Training and Simulation<br>
[inputs,inputStates,layerStates,targets] = preparets(net,X,{},T);<br>
<br>
% Setup Division of Data for Training, Validation, Testing<br>
net.divideParam.trainRatio = 70/100;<br>
net.divideParam.valRatio = 15/100;<br>
net.divideParam.testRatio = 15/100;<br>
<br>
% Train the Network<br>
[net,tr] = train(net,inputs,targets,inputStates,layerStates);<br>
<br>
Thanks for the help.

Mon, 11 Feb 2013 15:40:10 +0000
Re: How to display the actual and predicted value of training dataset in NARX
http://www.mathworks.com/matlabcentral/newsreader/view_thread/326484#897668
Arga Ridhalla
"Arga Ridhalla" <arga.ridhalla@yahoo.co.id> wrote in message <kf0ifj$jd$1@newscl01ah.mathworks.com>...<br>
> "Greg Heath" <heath@alumni.brown.edu> wrote in message <kf06f4$bd7$1@newscl01ah.mathworks.com>...<br>
> > "Arga Ridhalla" <arga.ridhalla@yahoo.co.id> wrote in message <ker31p$85u$1@newscl01ah.mathworks.com>...<br>
> > > Hi all,<br>
> > > I'm a beginner in NN. I have dataset contain 8 timeseries input variables and 1 timeseries 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. <br>
> > > <br>
> > > Thanks for the help!<br>
> > <br>
> > Post your code so that we can help.<br>
> > <br>
> > Greg<br>
> Hi, Greg! Here's the code:<br>
> <br>
> S=load('nanas Dataset full');<br>
> X=con2seq(S.S.nanasInputReducted);<br>
> T=con2seq(S.S.nanasTargetCopy);<br>
> % Create a Nonlinear Autoregressive Network with External Input<br>
> inputDelays = 12;<br>
> feedbackDelays = 12;<br>
> hiddenLayerSize = 10;<br>
> net = narxnet(1:inputDelays,1:feedbackDelays,hiddenLayerSize);<br>
> net.trainFcn='traingdm';<br>
> net.trainParam.epochs=10000;<br>
> net.trainParam.lr=1;<br>
> net.trainParam.mc=1;<br>
> net.trainParam.max_fail=100;<br>
> net.layers{1}.transferFcn ='logsig';<br>
> <br>
> % Prepare the Data for Training and Simulation<br>
> [inputs,inputStates,layerStates,targets] = preparets(net,X,{},T);<br>
> <br>
> % Setup Division of Data for Training, Validation, Testing<br>
> net.divideParam.trainRatio = 70/100;<br>
> net.divideParam.valRatio = 15/100;<br>
> net.divideParam.testRatio = 15/100;<br>
> <br>
> % Train the Network<br>
> [net,tr] = train(net,inputs,targets,inputStates,layerStates);<br>
> <br>
> Thanks for the help.<br>
<br>
Please help me with this problem. I really need some answers or solutions for my final project at my college. Thanks :)

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

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

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

Sun, 17 Feb 2013 16:24:06 +0000
Re: How to display the actual and predicted value of training dataset in NARX
http://www.mathworks.com/matlabcentral/newsreader/view_thread/326484#898127
Greg Heath
"Greg Heath" <heath@alumni.brown.edu> wrote in message <kfpeh5$hb0$1@newscl01ah.mathworks.com>...<br>
> "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?<br>
> > <br>
<br>
With no input, use narnet.<br>
<br>
Hope thid helps.<br>
<br>
Greg