使用nnet时出错

时间:2014-03-11 21:42:18

标签: r nnet

这是一个关于nnet的老问题。但是,我没有看到这个问题的答案。

当我们使用nnet时,它会报告错误如下:

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

例如

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

2 个答案:

答案 0 :(得分:1)

对于分类问题,您应该使用:

  

SOFTMAX = TRUE

答案 1 :(得分:0)

请查看predict.nnet的帮助页面以获取分类nnet的示例。我的猜测是你没有答案的矩阵。