How to change " 'Positive' Class : 0" from 0 to 1?

Greetings all,
How can I change " 'Positive' Class : 0" from 0 to 1, while using caret...

I am using "tidyverse: 1.3.0", "caret:6.0-84 ", "kernlab:0.9-29" , Rstudio:1.2.5019, R version 3.6.1 (2019-07-05), Platform: x86_64-pc-linux-gnu (64-bit), Running under: Linux Mint 19.2

I am running the code:

tcontrol <- trainControl(method = "repeatedcv",
                         number = 10,
                         repeats = 5,
                         savePredictions = "final") # IMPORTANT: this saves predictions for later retrieval

model_obj <- train(Class ~ .,
                   data = training_set,
                   method = "svmPoly",
                   trControl= tcontrol)

confusionMatrix(Predicted_test_vals, Class_test)

When I get the results back I find that the performances parameters for the Control test set not the Positive test set is being calculated.

Confusion Matrix and Statistics

Reference
Prediction   0   1
             0 238   8
             1   5 216

Accuracy : 0.9722          
95% CI : (0.9529, 0.9851)
...
 'Positive' Class : 0          <=== Change?     

I would like to know if there is a way to change the 'Positive Class to 1 not 0. I know it is a small difference, but would be nice.
Thank you

?confusionMatrix has

positive: an optional character string for the factor level that corresponds to a "positive" result

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.