3

it is an old question about nnet. However, i did not see the answer to this problem.

when we use nnet, sometimes, it will report error as the following:

Error in y - tmp : non-numeric argument to binary operator

example

seedsANN = nnet(train, trainlabel, size=1, entropy=F,softmax=F)
# weights:  17
initial  value 62.959997 
iter  10 value 27.216423
iter  20 value 23.659429
iter  30 value 23.451713
iter  40 value 23.326524
iter  50 value 23.221853
iter  60 value 22.933211
iter  70 value 20.989597
iter  80 value 20.354299
iter  90 value 20.219403
iter 100 value 20.185571
final  value 20.185571 
stopped after 100 iterations
Error in y - tmp : non-numeric argument to binary operator


      AGTR1  EPAS1  EPAS2
17  0   0.399   0.8233
239 0.5038  0.6312  0.7317
151 0.3993  0.7989  0.915
259 0.3092  1   0.9124
260 0   0.3781  0.4116
29  0.06    0.4205  0.3437333333


trainlable is 

0
1
0
1
1
0
1
agstudy
  • 119,832
  • 17
  • 199
  • 261
Shicheng Guo
  • 1,233
  • 16
  • 19
  • 1
    Impossible to help you without data! I guees you get an error because y or tmp is a character. `"1"-1` reproduce the error. – agstudy Mar 11 '14 at 22:01

2 Answers2

1

For classification problems you should use:

softmax=TRUE

lorelai
  • 147
  • 1
  • 2
  • 9
0

Look at the help page for predict.nnet for an example of classification nnet. My guess is that you don't have a matrix for the y answer.