"since any summary function is used, predictions that are already binary are transmitted"
This is definitely not the case.
It cannot use classes to compute the ROC curve (unless you do so). See note below.
train can predict classes as factors (using the internal code that you show) and / or class probabilities.
For example, this code will calculate the probabilities of classes and use them to get the area under the ROC curve:
library(caret)
library(mlbench)
data(Sonar)
ctrl <- trainControl(method = "cv",
summaryFunction = twoClassSummary,
classProbs = TRUE)
set.seed(1)
gbmTune <- train(Class ~ ., data = Sonar,
method = "gbm",
metric = "ROC",
verbose = FALSE,
trControl = ctrl)
In fact, if you omit the bit classProbs = TRUE, you will get an error message:
train() use of ROC codes requires class probabilities. See the classProbs option of trainControl()
Max
source
share