R returns 错误中的 LOOCV

LOOCV in R returns error

最近几天我开始熟悉R(我来自MATLAB和Python)。我想试用 caret 包(非常棒),当我尝试使用 LOOCV

进行训练时,我不断收到以下错误消息
Error in `[.data.frame`(tuneAcc, , params, drop = FALSE) : 
  undefined columns selected

现在,一开始我以为"ok, I'm doing something wrong here"。但后来我使用了 http://machinelearningmastery.com/ 中的代码:

library(caret)
# load the iris dataset
data(iris)
# define training control
train_control <- trainControl(method="LOOCV")
# train the model
model <- train(Species~., data=iris, trControl=train_control, method="nb")
# summarize results
print(model)

其中returns同样的错误。完整代码可以在以下地址 http://machinelearningmastery.com/how-to-estimate-model-accuracy-in-r-using-the-caret-package/ 找到。我搞砸了 R 的安装吗?难道我做错了什么?

这是 print.train 函数中的错误。另请参见 github 上的 issue 435。它应该在下一次更新 caret(6.0-70 或更高版本)时得到修复。

顺便说一下,这个模型没有任何问题。您仍然可以使用它来进行预测。