R - Caret - Using ROC instead of precision in model training

Hi my name is Abhi and i am using caret to create gbm based model. However, instead of precision, I would like to use roc as my metric

Here is the code I have so far

myTuneGrid <- expand.grid(n.trees = 500,interaction.depth = 11,shrinkage = 0.1)
fitControl <- trainControl(method = "repeatedcv", number = 7,repeats = 1, verboseIter = FALSE,returnResamp = "all",classProbs = TRUE)
myModel <- train(Cover_Type ~ .,data = modelData,method = "gbm",trControl = fitControl,tuneGrid = myTuneGrid,metric='roc')

      

However, when I run this code, I get a warning

Warning message:
In train.default(x, y, weights = w, ...) :
The metric "roc" was not in the result set. Accuracy will be used instead.

      

How do I get my model to use roc instead of precision. What am I doing wrong here?

+3


source to share


1 answer


Here is a github project link for source code? https://github.com/rseiter/PracticalMLProject/blob/master/multiClassSummary.R



+1


source







All Articles