| roc_curve | R Documentation |
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.
roc_curve(true_labels, predicted_prob, max_points = NULL)
true_labels |
Factor: True outcome labels. |
predicted_prob |
Numeric vector or matrix [0, 1]: Predicted
probabilities for the positive class (second level of |
max_points |
Optional Integer [2, Inf): Cap on the number of vertices
per curve. |
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.
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.
EDG
true_labels <- factor(c("A", "B", "A", "A", "B", "A", "B", "B", "A", "B"))
predicted_prob <- c(0.1, 0.4, 0.35, 0.8, 0.65, 0.2, 0.9, 0.55, 0.3, 0.7)
roc_curve(true_labels, predicted_prob)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.