Tina
Tina

Reputation: 21

How to fix "The metric "Accuracy" was not in the result set. AUC will be used instead"

I am trying to run a logistic regression on a classification problem

the dependent variable "SUBSCRIBEDYN" is a factor with 2 levels ("Yes" and "No")

train.control <- trainControl(method = "repeatedcv",
number = 10,
repeats = 10,
verboseIter = F,
classProbs = T,
summaryFunction = prSummary)

set.seed(13)
simple.logistic.regression <- caret::train(SUBSCRIBEDYN ~ .,
data = train_data,
method = "glm",
metric = "Accuracy",
trControl = train.control)


simple.logistic.regression`

However, it does not accept Accuracy as a metric "The metric "Accuracy" was not in the result set. AUC will be used instead"

Upvotes: 2

Views: 1971

Answers (1)

Falco
Falco

Reputation: 183

For a classification model with 2 levels, you should use metric="ROC". metric="Accuracy" is used for multiple classes. However, after training the model, you can use the confusion matrix to retrieve the accuracy, for example using the function confusionMatrix().

Upvotes: 1

Related Questions