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

1 Answer

+2 votes
by (348k points)
selected by
Best answer

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.

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