title: Neural network in R using the caret package
body: <p>So I've read a paper that had used neural networks to model out a dataset which is similar to a dataset I'm currently using. I have 160 descriptor variables that I want to model out for 160 cases (regression modelling). The paper I read used the following parameters:-</p>
  
  <p>'For each split, a model was developed for each of the 10 individual train-test folds. A three layer back-propagation net with 33 input neurons and 16 hidden neurons was used with online weight updates, 0.25 learning rate, and 0.9 momentum. For each fold, learning was conducted from a total of 50 different random initial weight starting points and the network was allowed to iterate through learning epochs until the mean absolute error (MAE) for the validation set reached a minimum. '</p>
  
  <p>Now they used a specialist software called Emergent in order to do this, which is a very specialised neuronal network model software. However, as I've done previous models before in R, I have to keep to it. So I'm using the caret train function in order to do 10 cross fold validation, 10 times with the neuralnet package. I did the following:-</p>
  
  <pre><code>cadets.nn &lt;- train(RT..seconds.~., data = cadet, method = "neuralnet", algorithm = 'backprop', learningrate = 0.25, hidden = 3, trControl = ctrl, linout = TRUE)
  </code></pre>
  
  <p>I did this to try and tune the parameters as closely to the ones used in the paper, however I get the following error message:-</p>
  
  <pre><code>  layer1 layer2 layer3 RMSE Rsquared RMSESD RsquaredSD
  1      1      0      0  NaN      NaN     NA         NA
  2      3      0      0  NaN      NaN     NA         NA
  3      5      0      0  NaN      NaN     NA         NA
  Error in train.default(x, y, weights = w, ...) : 
    final tuning parameters could not be determined
  In addition: There were 50 or more warnings (use warnings() to see the first 50)
  </code></pre>
  
  <p>Do you know what I'm doing wrong? It works when I do nnet, but I can't tune the parameters for that to make it similar to the ones used in the paper I'm trying to mimic. </p>
  
  <p>This is what I get in the warnings() fifty times:-</p>
  
  <pre><code>1: In eval(expr, envir, enclos) :
    model fit failed for Fold01.Rep01: layer1=1, layer2=0, layer3=0 Error in neuralnet(form, data = data, hidden = nodes, ...) : 
    formal argument "hidden" matched by multiple actual arguments
  
  2: In data.frame(..., check.names = FALSE) :
    row names were found from a short variable and have been discarded
  3: In eval(expr, envir, enclos) :
    model fit failed for Fold01.Rep01: layer1=3, layer2=0, layer3=0 Error in neuralnet(form, data = data, hidden = nodes, ...) : 
    formal argument "hidden" matched by multiple actual arguments
  
  4: In data.frame(..., check.names = FALSE) :
    row names were found from a short variable and have been discarded
  5: In eval(expr, envir, enclos) :
    model fit failed for Fold01.Rep01: layer1=5, layer2=0, layer3=0 Error in neuralnet(form, data = data, hidden = nodes, ...) : 
    formal argument "hidden" matched by multiple actual arguments
  </code></pre>
  
  <p>Thanks!</p>