Compute the points of one or more ROC curves from true labels and predicted
probabilities, returning tidy (class, fpr, tpr, auc) rows. The rows serve any consumer of the
curve data, such as a client that renders the curve.
data.frame with columns class, fpr, tpr, auc (the AUC is
constant within a class group, repeated per vertex). Zero rows when no
curve is defined.
Arguments
true_labels
Factor: True outcome labels.
predicted_prob
Numeric vector or matrix [0, 1]: Predicted
probabilities for the positive class (second level of true_labels), as a
vector or a one-column matrix. For multiclass, a matrix with exactly one
column per class, in factor-level order (rtemis's convention); the columns
are labeled with the factor levels regardless of any names on the input.
max_points
Optional Integer [2, Inf): Cap on the number of vertices
per curve. NULL keeps full resolution.
Author
EDG
Details
Binary problems yield a single curve for the positive class (the second
level of true_labels, rtemis convention); multiclass problems yield one
one-vs-rest curve per class. Points are ordered along the curve; pass
max_points to down-sample very long curves (one vertex per distinct score)
to a compact, smooth line.