It's not strange that caret thinks you are asking for classification, because you are actually doing so in these 2 lines of your trainControl function:classProbs = TRUE,summaryFunction = twoClassSummary删除这两行(以使它们采用默认值-请参见函数文档),那应该没事.Remove both these lines (so as they take their default values - see the function documentation), and you should be fine.还请注意,AUC仅适用于分类问题.Notice also that AUC is only applicable to classification problems. 更新(在注释后):似乎目标变量为整数会导致问题;使用UPDATE (after comments): Seems that the target variable being integer causes the problem; convert it to double before running the model withtrain$sal <- as.double(train$sal) 这篇关于插入符号上的R xgboost尝试执行分类而不是回归的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-20 09:11