title: R - ensemble with neural network?
body: <p>This is a small sample of my data.frame </p>
  
  <pre><code>    naiveBayesPrediction knnPred5 knnPred10 dectreePrediction logressionPrediction correctClass
  1                non-bob        2         2           non-bob    0.687969711847463            1
  2                non-bob        2         2           non-bob     0.85851872253358            1
  3                non-bob        1         1           non-bob    0.500470892627383            1
  4                non-bob        1         1           non-bob     0.77762739066215            1
  5                non-bob        1         2           non-bob    0.556431439357365            1
  6                non-bob        1         2           non-bob    0.604868385598237            1
  7                non-bob        2         2           non-bob    0.554624186182919            1
  </code></pre>
  
  <p>I have factored everything</p>
  
  <pre><code>   'data.frame':    505 obs. of  6 variables:
       $ naiveBayesPrediction: Factor w/ 2 levels "bob","non-bob": 2 2 2 2 2 2 2 2 2 2 ...
       $ knnPred5            : Factor w/ 2 levels "1","2": 2 2 1 1 1 1 2 1 2 1 ...
       $ knnPred10           : Factor w/ 2 levels "1","2": 2 2 1 1 2 2 2 1 2 2 ...
       $ dectreePrediction   : Factor w/ 1 level "non-bob": 1 1 1 1 1 1 1 1 1 1 ...
       $ logressionPrediction: Factor w/ 505 levels "0.205412826873861",..: 251 415 48 354 92 145 90 123 28 491 ...
       $ correctClass        : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 1 1 ...
  </code></pre>
  
  <p>I then tried to ensemble it using neuralnet</p>
  
  <pre><code>ensembleModel &lt;- neuralnet(correctClass ~ naiveBayesPrediction + knnPred5 + knnPred10 + dectreePrediction + logressionPrediction, data=allClassifiers[ensembleTrainSample,])
  </code></pre>
  
  <blockquote>
    <p>Error in neurons[[i]] %*% weights[[i]] :    requires numeric/complex
    matrix/vector arguments</p>
  </blockquote>
  
  <p>I then tried to put in a matrix</p>
  
  <pre><code>m &lt;- model.matrix( correctClass ~ naiveBayesPrediction + knnPred5 + knnPred10 + dectreePrediction + logressionPrediction, data = allClassifiers )
  </code></pre>
  
  <blockquote>
    <p>Error in <code>contrasts&lt;-</code>(<code>*tmp*</code>, value = contr.funs[1 + isOF[nn]]) :<br>
    contrasts can be applied only to factors with 2 or more levels</p>
  </blockquote>
  
  <p>I think it must be something to do with the one feature "decistreePrediction" only having 1 level but it only finds one level out of 2 possible outcomes (bob or non-bob) so I have no idea where to go from there.</p>