[R] Using nnet

David Forrest drf5n at maplepark.com
Tue Mar 27 18:35:56 CEST 2007


On Tue, 27 Mar 2007, Nguyen Thanh Khiem wrote:

> I have a problem when using nnet to predict the negative values. For example
> :
>
> X = matrix(c(1,1,0,0,1,0,1,0),4,2)
> X
> Y = matrix(c(0,1,1,0)) - 0.5 # XOR - 0.5
> Y
> nn = nnet(X,Y,size=3)
> val = predict(nn,X)
> val # this is expected to be close to Y, but it's not !
>
> The 'val' is always positive. I tried to change the options, but the result
> isn't much better.

nn = nnet(X,Y,size=3,linout=TRUE)
> val = predict(nn,X)
> val # this is expected to be close to Y, but it's not !
            [,1]
[1,] -0.4994022
[2,]  0.4996643
[3,]  0.4994101
[4,] -0.4996929

>
> Could someone give me an advice ? I searched everywhere I can but nothing
> found.

?nnet

especially:

   linout: switch for linear output units. Default logistic output
           units.

>
> Thanks a lot.
>
>

Dave
-- 
  Dr. David Forrest
  drf at vims.edu                                    (804)684-7900w
  drf5n at maplepark.com                             (804)642-0662h
                                    http://maplepark.com/~drf5n/



More information about the R-help mailing list