我正在尝试创建一个二元分类器,使用 caret
进行建模以优化ROC . 我尝试的方法是 C5.0
,我得到以下错误和警告:
Error in train.default(x, y, weights = w, ...) :
final tuning parameters could not be determined
In addition: Warning messages:
1: In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo, :
There were missing values in resampled performance measures.
2: In train.default(x, y, weights = w, ...) :
missing values found in aggregated results
我之前使用 C5.0
和 caret
建模了相同的训练数据,但是在控制中优化了精度并且没有使用twoClassSummary,并且它运行时没有错误 .
我的调整网格和ROC运行的控制是
c50Grid <- expand.grid(.trials = c(1:9, (1:10)*10),
.model = c("tree", "rules"),
.winnow = c(TRUE, FALSE))
fitTwoClass <- trainControl(
method = "repeatedcv",
number = 5,
repeats = 5,
classProbs=TRUE,
summaryFunction = twoClassSummary
)
在精度运行期间,我省略了控件的 classProbs
和 summaryFunction
部分 .
对于建模,命令是
fitModel <- train(
Unhappiness ~ .,
data = dnumTrain,
tuneGrid=c50Grid,
method = "C5.0",
trControl = fitTwoClass,
tuneLength = 5,
metric= "ROC"
)
任何人都可以建议如何解决这个问题?不确定要调整哪个参数以使其工作,而我相信数据集应该没问题(因为它在优化精度时运行正常) .
要重现,可以从this link中的文件 load
编辑训练集 dnumTrain
.
1 回答
我想我可能已经解决了这个问题:在评论中看到@Pascal能够无误地运行代码,并意识到我得到了一个非常随机的结果运行它
ctree
,我调查了可能与随机性有关的其他区域:随机种子 .似乎问题来自于我使用
doSNOW
将处理并行处理到4个处理器,并且需要为每次迭代设置种子以避免随机爬行(参见this question的回答) . 我怀疑随机数据导致某些折叠没有有效值 .在任何情况下,我将种子设置如下:
到目前为止,我已经重新训练了
fitModel
3次并且没有错误/警告,所以我希望这确实是我的问题的答案 .