| roc_curve | R Documentation |
Computes the receiver operating characteristic curve for binary
classification predictions, using pROC::roc() as the backend.
roc_curve(truth, prob, positive = NULL)
truth |
Factor (or coercible to factor) of true class labels. |
prob |
Predicted probability of the positive class, or a probability matrix/data frame with one column per class level. |
positive |
Optional positive class level. Defaults to the second factor level. |
A funcml_roc object: a list with a curve data frame
(threshold, sensitivity, specificity), the AUC, and the
underlying pROC::roc object (proc).
if (requireNamespace("pROC", quietly = TRUE)) {
set.seed(1)
truth <- factor(rbinom(100, 1, 0.4))
prob <- runif(100)
roc_obj <- roc_curve(truth, prob)
roc_obj$curve
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.