[R] Toying with neural networks

Cerviño Beresi Ulises cervino at ifir.edu.ar
Tue Feb 8 15:06:31 CET 2005


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

-- 
Ulises Cerviño
---
I place economy among the first and most important virtues, and public
debt as
the greatest of dangers to be feared.  To preserve our independence, we
must
not let our rulers load us with perpetual debt.  If we run into such
debts, we
must be taxed in our meat and drink, in our necessities and in our
comforts,
in our labor and in our amusements.  If we can prevent the government
from
wasting the labor of the people, under the pretense of caring for them,
they
will be happy.
                -- Thomas Jefferson




More information about the R-help mailing list