在 eval(expr, envir, enclos) 中:Fold01 的模型拟合失败:

In eval(expr, envir, enclos) : model fit failed for Fold01:

我正在尝试同时使用包 caret 和 nnet,但出现以下错误。我使用 warnings() 来查看它是什么,但在互联网上找不到任何东西。请告诉我。谢谢。

> 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

如果您将 linout 设置为 False,您的代码可能会正常工作。 Linout 设置为 True 开关用于线性输出单元。您的 Win 变量是二进制变量而不是连续变量。至少它将摆脱仅适用于物流单位消息的熵。