+4 votes
in Machine Learning by (20.4k points)
I have binary labels and predicted probabilities. Which R function should I use to calculate the ROC_ROC?

1 Answer

+2 votes
by (48.9k points)

You can use the auc() function of the pROC library to calculate the AUC ROC. This function computes the numeric value of the area under the ROC curve (AUC) with the trapezoidal rule.

In the following example, I have generated random probabilities "preds" and labels "y" to compute AUC.

library(pROC)
preds <- runif(n=20)
y <- rbinom(length(preds), prob = preds, size = 1)
auc(y, preds)


...