From: Wensui Liu <liuwensui_at_gmail.com>

Date: Mon 29 Jan 2007 - 01:38:52 GMT

Date: Mon 29 Jan 2007 - 01:38:52 GMT

AM,

Don't worry. It is correct to get different correlation each time.
Unless you are very lucky, you will get different prediction for each
different training process, depending on your initial random state.

Take a look at Dr Ripley's MASS book, there are several excellent examples on how to use nnet.

On 1/28/07, Aimin Yan <aiminy@iastate.edu> wrote:

> Hello,

*> I use nnet to do prediction for a continuous variable.
**> after that, I calculate correlation coefficient between predicted value and
**> real observation.
**>
**> I run my code(see following) several time, but I get different correlation
**> coefficient each time.
**>
**> Anyone know why?
**>
**> In addition, How to calculate prediction accuracy for prediction of
**> continuous variable?
**>
**> Aimin
**> thanks,
**>
**>
**> > m.nn.omega <- nnet(omega~aa_three+bas+bcu+aa_ss, data=training, size=2,
**> linout=TRUE)
**> # weights: 57
**> initial value 89153525.582093
**> iter 10 value 15036439.951888
**> iter 20 value 15010796.121891
**> iter 30 value 15000761.804392
**> iter 40 value 14955839.294531
**> iter 50 value 14934746.564215
**> iter 60 value 14933978.758615
**> iter 70 value 14555668.381007
**> iter 80 value 14553072.231507
**> iter 90 value 14031071.223996
**> iter 100 value 13709055.312482
**> final value 13709055.312482
**> stopped after 100 iterations
**> > pr.nn.train<-predict(m.nn.omega,training)
**> > corr.pr.nn.train<-round(cor(pr.nn.train,training$omega),2)
**> > pr.nn.test<-predict(m.nn.omega,test)
**> > corr.pr.nn.test<-round(cor(pr.nn.test,test$omega),2)
**> > cat("correlation coefficient for train using neural
**> network:",corr.pr.nn.train,"\n")
**> correlation coefficient for train using neural network: 0.32
**> > cat("correlation coefficient for test using neural
**> network:",corr.pr.nn.test,"\n")
**> correlation coefficient for test using neural network: 0.39
**>
**> ______________________________________________
**> R-help@stat.math.ethz.ch mailing list
**> https://stat.ethz.ch/mailman/listinfo/r-help
**> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
**> and provide commented, minimal, self-contained, reproducible code.
**>
*

-- WenSui Liu A lousy statistician who happens to know a little programming (http://spaces.msn.com/statcompute/blog) ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.Received on Mon Jan 29 12:47:37 2007

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Mon 29 Jan 2007 - 02:30:25 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*