Let's consider data
set.seed(20)
y <- sample(0:1, 100, replace = T)
x <- data.frame(rnorm(100), rexp(100))
I want to perform cross validation and output sensitivity and specificity. I found out that I can provide additional input to train function 'metric' to specify which metric I want to have. SO :
# train the model on training set
library(caret)
cross <- train(as.factor(y) ~ .,
data = cbind(y,x),
metric = 'Sensitivity',
trControl = trainControl(method = "cv", number = 5)
,
method = "glm",
family = binomial()
)
However I see the problem :
The metric "Sensitivity" was not in the result set. Accuracy will be used instead.
Is there any solution how Sensitivity and specificity can be used in cross validation ?