[R] How to output ROC/AUC in caret?

Neha gupta neh@@bo|ogn@90 @end|ng |rom gm@||@com
Tue Apr 19 19:08:37 CEST 2022


Hello everyone

I use the caret library to train a model and need to output ROC/AUC score,
however, caret outputs 'Accuracy' and not ROC/AUC.

The code is here

cv.folds <- createMultiFolds(train$TYPE, k = 10, times = 3)

ctrl <- trainControl(method = "cv",number=3, index = cv.folds, classProbs =
TRUE, summaryFunction = multiClassSummary)


m= train(y = train_label, x = train_x,
      method = "rpart" , na.action = na.pass,
      metric = "ROC",
      preProc = c("center", "scale", "nzv"),
      trControl = ctrl)

p=predict(m, test_x)
confusionMatrix(p, as.factor(test_label))

	[[alternative HTML version deleted]]



More information about the R-help mailing list