我有一个带有两个类的不平衡数据集,因此我认为我可以使用ROC作为度量而不是精度来使用插入包在R中调整我的模型(我正在尝试不同的方法,例如rpart,rf..etc)。 我认为我们可以提取概率并使用ROC作为决策树类型算法中的度量标准以及使用插入符号。 我使用下面的插入符号中的数据集来说明我的问题。 这个数据有三个类,但我重新定义并创建了两个类用于说明目的。 我不明白为什么下面的代码给出了这个错误(当我改变方法时我一直得到同样的错误)。 我感谢您的帮助。
'train.default(x,y,weights = w,...)出错:无法确定最终调整参数另外:警告消息:1:在nominalTrainWorkflow中(x = x,y = y,wts =权重, info = trainInfo,:重新采样的性能指标中缺少值.2:在train.default(x,y,weights = w,...)中:在聚合结果中找到缺失的值'
library(caret) data(iris) iris$Species=as.character(iris$Species) iris$Species[which(iris$Species=='virginica')]='versicolor' iris$Species=as.factor(iris$Species) fitControl <- trainControl(method = "cv",number=5,classProbs = TRUE,summaryFunction = twoClassSummary) RF=train(Species ~ ., data = iris, method="rpart",metric="ROC", trControl=fitControl)I have an imbalanced data set with two classes therefore I thought I could use ROC as a metric instead of Accuracy to tune my model in R using caret package (I am trying different methods such as rpart, rf..etc). I thought we could extract probabilities and use ROC as a metric in decision tree type algorithms as well using caret. I illustrate my problem using a data set in caret below. There are three classes in this data but I redefined and created two classes for illustration purposes. I don't understand why the below code gives this error (I keep getting the same error when I change the method). I appreciate your help.
'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'
library(caret) data(iris) iris$Species=as.character(iris$Species) iris$Species[which(iris$Species=='virginica')]='versicolor' iris$Species=as.factor(iris$Species) fitControl <- trainControl(method = "cv",number=5,classProbs = TRUE,summaryFunction = twoClassSummary) RF=train(Species ~ ., data = iris, method="rpart",metric="ROC", trControl=fitControl)最满意答案
这可能是您的r和插入符号版本的问题。 更新插入符号包时,请确保您的r版本也保持更新。
我之前有过这个错误,更新r版本解决了它。
It might be a problem with your versions of r and caret. When you update your caret package, make sure that your version of r is kept updated as well.
I had this error before and updating r version solved it.
更多推荐
发布评论