Skip to contents

Higher scores always indicate the named positive class. Each distinct score is one threshold, and a tied block enters at once. Average precision is the step-wise sum \(\sum_k (R_k - R_{k-1}) P_k\) over thresholds, which is the area under the stepped curve. Precision has no value before the first threshold, so the curve starts at recall 0 with the precision of the first threshold, adding no area. The curve ends at the threshold that predicts every case positive, where precision is the prevalence of the positive class. A class with no positive observation has an undefined curve.

Usage

pr_vertices(x)

Arguments

x

List: Normalized labels and probabilities from roc_probabilities().

Value

Data frame of class, recall, precision, average precision (ap), prevalence, and omitted-pair counts.

Examples

pr_vertices(roc_probabilities(factor(c("no", "yes")), c(0.1, 0.9)))
#>   class recall precision ap prevalence omitted
#> 1   yes      0       1.0  1        0.5       0
#> 2   yes      1       1.0  1        0.5       0
#> 3   yes      1       0.5  1        0.5       0