[R] nnet question
Weiwei Shi
helprhelp at gmail.com
Mon Jan 29 03:24:35 CET 2007
try to use
set.seed(10)
before you call nnet and see if you have the same correlation each time.
I did not try by myself, though.
On 1/28/07, Aimin Yan <aiminy at 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 at 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.
>
--
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.
"Did you always know?"
"No, I did not. But I believed..."
---Matrix III
More information about the R-help
mailing list