title: How to use size and decay in nnet
body: <p>I am quite new to the neural network world so I ask for your understanding. I am generating some tests and thus I have a question about the parameters <code>size</code> and <code>decay</code>. I use the <code>caret</code> package and the method <code>nnet</code>. Example dataset:</p>
  
  <pre><code>require(mlbench)
  require(caret)
  require (nnet)
  
  data(Sonar)
  mydata=Sonar[,1:12] 
  
  set.seed(54878)
  ctrl = trainControl(method="cv", number=10,returnResamp = "all")
  for_train= createDataPartition(mydata$V12, p=.70, list=FALSE) 
  my_train=mydata[for_train,]
  my_test=mydata[-for_train,] 
  
  t.grid=expand.grid(size=5,decay=0.2)
  mymodel = train(V12~ .,data=my_train,method="nnet",metric="Rsquared",trControl=ctrl,tuneGrid=t.grid) 
  </code></pre>
  
  <p>So, two are my questions. First, is this the best way with caret to use the nnet method?Second, I have read about the size and the decay (eg. <a href="https://stackoverflow.com/questions/9390337/purpose-of-decay-parameter-in-nnet-function-in-r">Purpose of decay parameter in nnet function in R?</a>) but I cannot understand how to use them in practice here. Can anyone help?</p>