plot_pr | R Documentation |
This function plots PR curves for one or several classifiers.
plot_pr( obs, pred, pal_curves = "npg", title = ifelse(is.numeric(pred), "Precision-Recall Curve", "Precision-Recall Curves"), leg.txt = NULL, legend = "topright", hover = FALSE )
obs |
Vector of observed outcomes. Must be dichotomous. Can be numeric,
character, factor, or logical. If numeric, |
pred |
Vector of predicted values, or several such vectors organized into a data frame or list, optionally named. Must be numeric. Common examples include the probabilities output by a logistic model, or the expression levels of a particular biomarker. |
pal_curves |
String specifying the color palette to use when plotting
multiple vectors. Options include |
title |
Optional plot title. |
leg.txt |
Optional legend title. |
legend |
Legend position. Must be one of |
hover |
Show predictor name by hovering mouse over PR curve? If |
PR curves plot the precision (i.e., positive predictive value) against the
recall (i.e., true positive rate/sensitivity) for a given classifier and
vector of observations. The area under the PR curve (AUC) is a useful
performance metric for binary classifiers, especially in cases of extreme
class imbalance, which is typical in omic contexts (Saito & Rehmsmeier,
2015). The grey horizontal line represents the performance of a theoretical
random classifier. Interpolations for tied pred
values are computed
using the nonlinear method of Davis & Goadrich (2006).
Davis, J. & Goadrich, M. (2006). The Relationship Between Precision-Recall and ROC Curves. In Proceedings of the 23rd International Conference on Machine Learning, pp. 223-240. New York: ACM.
Saito, T. & Rehmsmeier, M. (2015). The Precision-Recall Plot Is More Informative than the ROC Plot When Evaluating Binary Classifiers on Imbalanced Datasets. PLoS ONE, 10(3): e0118432.
y <- rbinom(1000, size = 1, prob = 0.1) x1 <- rnorm(1000, mean = y) plot_pr(obs = y, pred = x1) x2 <- rnorm(1000, mean = y, sd = 2) plot_pr(obs = y, pred = list("Better" = x1, "Worse" = x2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.