Returns the area under the curve ("AUC") of a receiver-operating characteristic curve for the given predicted and actual values.

auc(actual, pred)

Arguments

actual

Logical vector: TRUE for positive class. If not a logical vector, the result is interpreted as one if safe to do so, viz. if actual contains precisely two unique values and is either a numeric vector, an ordered factor, or the unique values are FALSE and TRUE (case-insensitively). Anything else is an error.

pred

Numeric (double) vector the same length as actual giving the predicted probability of TRUE. Must be a numeric vector the same length as actual.

Source

Source code based on Metrics::auc from Ben Hamner and Michael Frasco and Erin LeDell from the Metrics package.