0
votes

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)
1
The code above works for me. What is the actual error?chupvl
This is the error I get. It doesn't work for me for any method. I don't know whyKTY
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'KTY

1 Answers

0
votes

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.