[R] nnet question
Aimin Yan
aiminy at iastate.edu
Sun Jan 28 23:49:23 CET 2007
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
More information about the R-help
mailing list