[R] question about nnet

Wensui Liu liuwensui at gmail.com
Sun Jan 28 20:54:46 CET 2007


in nnet(), you should add linout = TRUE. The default setting is logistic output.

hth.

On 1/28/07, Aimin Yan <aiminy at iastate.edu> wrote:
> I use neural network to predict a continuous variable( omega in training).
>
> But I get all "1" instead of real value.
>
> Do you know why?
>
> Aimin
>
> Thanks
>
> The following is code
>
>  > m.nn.omega <- nnet(omega~aa_three+bas+bcu+aa_ss, aata=training,size=2)
> # weights:  57
> initial  value 97329662.256069
> final  value 96367717.444383
> converged
>  > pr.nn.train<-predict(m.nn.omega,training,type="raw")
>  > head(pr.nn.train)
>    [,1]
> 1    1
> 2    1
> 3    1
> 4    1
> 5    1
> 6    1
>  > head(training)
>      pr aa_three aa_one aa_ss aa_pos    aas bas   ams bms        acu
> bcu     omega       y index
> 1 1acx      ALA      A     C      1 127.71   0 69.99   0
> -0.2498560   0  79.91470 outward  TRUE
> 2 1acx      PRO      P     C      2  68.55   0 55.44   0
> -0.0949008   0  76.60380 outward  TRUE
> 3 1acx      ALA      A     E      3  52.72   0 47.82   0
> -0.0396550   0  52.19970 outward  TRUE
> 4 1acx      PHE      F     E      4  22.62   0 31.21   0  0.1270330   0
> 169.52500  inward  TRUE
> 5 1acx      SER      S     E      5  71.32   0 52.84   0
> -0.1312380   0   7.47528 outward  TRUE
> 6 1acx      VAL      V     E      6  12.92   0 22.40   0  0.1728390   0
> 149.09400  inward  TRUE
>
> ______________________________________________
> 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.
>


-- 
WenSui Liu
A lousy statistician who happens to know a little programming
(http://spaces.msn.com/statcompute/blog)



More information about the R-help mailing list