[R] nnet 10-fold cross-validation

David Meyer david.meyer at wu-wien.ac.at
Tue Jul 24 13:08:22 CEST 2007


Hi all,

there is tune() in the e1071 package for doing this in general, and, 
among others, a tune.nnet() wrapper (see ?tune):


 > tmodel = tune.nnet(Species ~ ., data = iris, size = 1:5)
 > summary(tmodel)

Parameter tuning of `nnet':

- sampling method: 10-fold cross validation

- best parameters:
  size
     1

- best performance: 0.01333333

- Detailed performance results:
   size      error dispersion
1    1 0.01333333 0.02810913
2    2 0.02666667 0.04661373
3    3 0.02666667 0.04661373
4    4 0.02000000 0.04499657
5    5 0.02666667 0.04661373

 > plot(tmodel)
 > tmodel$best.model
a 4-1-3 network with 11 weights
inputs: Sepal.Length Sepal.Width Petal.Length Petal.Width
output(s): Species
options were - softmax modelling

etc.

Best
David



On 7/23/07, S.O. Nyangoma <S.O.Nyangoma at amc.uva.nl> wrote:
 > > Hi
 > > It clear that to do a classification with svm under 10-fold cross
 > > validation one uses
 > >
 > > svm(Xm, newlabs, type = "C-classification", kernel = "linear",cross =
 > > 10)
 > >
 > > What corresponds to the nnet?
 > > nnet(.....,cross=10)?



More information about the R-help mailing list