Get AUC value

get_auc(y_pred, y, type = c("pr", "roc"), curve = FALSE)

Arguments

y_pred

y prediction vector.

y

y true label vector.

type

AUC type, either 'pr' or 'roc'.

curve

if TRUE, generate plot data, the result can be plotted by plot().

Value

A object.

Examples

if (require("PRROC")) {
  set.seed(2021)
  auc <- get_auc(sample(1:10, 10), c(rep(0, 5), rep(1, 5)))
  auc
}