2016-04-15 40 views
0

我试图一起使用包caret和nnet,但是得到了下面的错误。我用警告()来查看它是什么,但在互联网上找不到任何东西。请告诉我。谢谢。在eval(expr,envir,enclos)中:模型适合Fold01失败:

> str(Std_data) 
'data.frame': 1628 obs. of 18 variables: 
$ Seed : num 1 1 1 1 1 1 1 1 1 1 ... 
$ Pyth : num 0.882 0.904 0.295 0.882 0.671 ... 
$ EFG : num 0.709 -0.212 -0.992 0.709 -0.291 ... 
$ PPP : num 0.506 0.2393 0.3952 0.506 0.0309 ... 
... 

$ PD  : num 2.17 2.03 1.47 1.4 1.19 ... 
$ OppSeed: num 16 16 16 9 16 5 3 3 12 3 ... 
$ Win : Factor w/ 2 levels "0","1": 2 2 2 2 2 2 1 1 2 1 ... 

> model <- train(Win ~ . - PD, data=Std_data, method='nnet', linout=TRUE, trace = FALSE, 
+    tuneGrid=expand.grid(.size=c(2:8),.decay=c(0,0.0001, 0.001,0.01,0.1)), trControl = trainControl(method = "cv")) 

Something is wrong; all the Accuracy metric values are missing: 
... 
Error in train.default(x, y, weights = w, ...) : Stopping 
In addition: There were 50 or more warnings (use warnings() to see the first 50) 

> warnings() 
Warning messages: 
1: In eval(expr, envir, enclos) : 
model fit failed for Fold01: size=2, decay=0e+00 Error in nnet.default(x, y, w, entropy = TRUE, ...) : 
entropy fit only for logistic units 

回答

1

如果将linout设置为False,那么你的代码可能会工作。线性输出单元的Linout设置为True开关。你的Win变量是一个不是连续变量的二元变量。至少它将摆脱仅适用于物流单位信息的熵配合。

相关问题