Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: How to display the actual and predicted value of training dataset in NARX
Posted:
Feb 16, 2013 9:16 PM
|
|
"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 :)
|
|
|
|