% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geoms-ml.R
\name{geom_pr}
\alias{geom_pr}
\title{Precision-recall curve}
\usage{
geom_pr(
  mapping = NULL,
  data = NULL,
  color = NULL,
  alpha = NULL,
  linewidth = NULL
)
}
\arguments{
\item{mapping, data}{Standard layer overrides. Map \code{truth} (actual
class; for factors the second level is the positive class) and
\code{score} (predicted score); map \code{color} to compare models.}

\item{color, alpha}{As in \code{\link[=geom_point]{geom_point()}}.}

\item{linewidth}{Curve width.}
}
\value{
A \link{Layer} to add with \code{+}.
}
\description{
Sweeps the classification threshold and plots recall (x) against
precision (y), with a horizontal baseline at the class prevalence
(instead of the diagonal \code{\link[=geom_roc]{geom_roc()}} uses) — the more informative
curve when positives are rare.
}
\examples{
set.seed(1)
s <- runif(200)
d <- data.frame(truth = rbinom(200, 1, s * 0.3), score = s)
ggnext(d, aes(truth = truth, score = score)) + geom_pr()
}
