[R] Toying with neural networks

Tom Mulholland tmulholland at bigpond.com
Tue Feb 8 16:40:33 CET 2005


You are not reading the help.

from the help file

      ## Default S3 method:
      nnet(x, y, weights, size, Wts, mask,
           linout = FALSE, entropy = FALSE, softmax = FALSE,
           censored = FALSE, skip = FALSE, rang = 0.7, decay = 0,
           maxit = 100, Hess = FALSE, trace = TRUE, MaxNWts = 1000,
           abstol = 1.0e-4, reltol = 1.0e-8, ...)

Look at MaxNWts



Cerviño Beresi Ulises wrote:
> Hello all, 
> 
> Ive been playing with nnet (package 'nnet') and Ive come across this
> problem. nnet doesnt seems to like to have more than 1000 weights. If I
> do:
> 
> 
>>data(iris)
>>names(iris)[5] <- "species"
>>net <- nnet(species ~ ., data=iris, size=124, maxit=10)
> 
> # weights:  995
> initial  value 309.342009
> iter  10 value 21.668435
> final  value 21.668435
> stopped after 10 iterations
> 
>>table(iris$species[], predict(net, iris[], type="class"))
> 
> 
>              setosa versicolor virginica
>   setosa     50      0          0
>   versicolor  0     46          4
>   virginica   0      0         50
> 
> It works just fine, but if I do:
> 
> 
>>net <- nnet(species ~ ., data=iris, size=125, maxit=10)
> 
> Error in nnet.default(x, y, w, softmax = TRUE, ...) :
>         Too many (1003) weights
> 
> Ive only changed 'size' from 124 to 125 giving me more than 1000
> weights.
> 
> Any ideas? Im I doing something wrong?
> 
> 
>>version
> 
>          _
> platform i386-pc-linux-gnu
> arch     i386
> os       linux-gnu
> system   i386, linux-gnu
> status
> major    2
> minor    0.1
> year     2004
> month    11
> day      15
> language R
>




More information about the R-help mailing list