title: classification in r neuralnet
body: <p>I'm using <code>neuralnet</code> in R to predict 3 classes based on 17 inputs. I have 3 classes: 1, 0 and 2. I have 2 files: training and testing. Training has 64 cases of 17 inputs and 18 column is output.</p>
  
  <pre><code>x1              x2              x3          etc...    x17                   y
  -0.002307       0.034095    -0.002733            0              1
  0.004461       -0.041385     0.137767          -0.294394        0
  -0.25254       -0.094523     0                  0.074733        0
  -0.25254       -0.094523     0                  0.074733        2
  </code></pre>
  
  <p>and more. 64 rows in total for training.</p>
  
  <p>The test set is exactly same as the training data (16 rows), just with different values.
  The code I use</p>
  
  <pre><code>library(neuralnet)
  
  nn &lt;- neuralnet(y ~ x1+x2+x3
                    +x4+x5+x6+x7+x8+x9+x10+x11+x12+x13+x14+x15+x16+x17, 
                  data=train,lifesign="full", hidden=15, err.fct="ce", 
                  linear.output=FALSE)
  an1 &lt;-  compute(nn, Test[1:17])
  </code></pre>
  
  <p>I can do prediction for nn training </p>
  
  <pre><code>prediction (nn)
  </code></pre>
  
  <p>Which gives me prediction classes columns y for training case sets but I cannot do same with </p>
  
  <pre><code>prediction (an1): error message
  
  Error in matrix(covariate[not.duplicated, ], nrow = nrow.notdupl) : 
    'data' must be of a vector type
  </code></pre>
  
  <p>I'm not entirely sure I need predict, or compute should be enough. But results for compute I get are:</p>
  
  <pre><code>$net.result
               [,1]
   [1,] 0.7503498233120
   [2,] 0.9982475522024
  ....
   [14,] 0.0007727434740
   [15,] 0.9999287879015
  </code></pre>
  
  <p>Which I don't know how to interpret it. I need something  like </p>
  
  <pre><code>  2                1            0
    [1,] 0.964182671 0.022183652 0.013633677
    [2,] 0.952685528 0.032202528 0.015111944
    [3,] 0.966094194 0.021206723 0.012699083..
  </code></pre>
  
  <p>with probability distribution to each class.</p>
  
  <p>I tried to use <code>ifelse</code></p>
  
  <pre><code> At2 &lt;-(ifelse(Train$y==2,"2", ifelse(Train$y==1, "1","0")))
  </code></pre>
  
  <p>but still get the same 1 column for <code>net.result</code>.</p>
  
  <p>Anyone could help to point out what line am I missing here to get what I want?
  Also I think <code>ifelse</code> does not do what I want - predict class Y based on 17 inputs. Is it so?</p>