Skip to contents

The prbe function finds the points of a precision-recall curve at which precision and recall are equal. It takes an S3 object generated by evalmod() and returns a data frame with one row per break-even point.

Usage

prbe(curves)

# S3 method for class 'curve_info'
prbe(curves)

Arguments

curves

An S3 object generated by evalmod().

Value

The prbe function returns a data frame with the columns modnames, dsids and prbe. prbe is the common value of precision and recall at the break-even point.

A curve can cross the diagonal more than once, and then the data frame holds one row per crossing, ordered by recall. A curve that never reaches equal precision and recall gets a single row of NA.

How this differs from ROCR

ROCR::performance(pred, "prbe") interpolates linearly between adjacent raw precision-recall points to find the crossing. Linear interpolation between precision-recall points is not correct, which is the reason this package exists, so prbe reads the crossing off the curve evalmod() has already interpolated properly. The two agree wherever the crossing falls on a point both of them hold, and differ where it falls between two of them.

See also

evalmod() for generating S3 objects with performance evaluation measures. auc() for the areas under the curves.

Examples


##################################################
### Single model & single test dataset
###
samps <- create_sim_samples(1, 50, 50, "good_er")
sscurves <- evalmod(scores = samps[["scores"]], labels = samps[["labels"]])
prbe(sscurves)

##################################################
### Multiple models & multiple test datasets
###
samps2 <- create_sim_samples(2, 50, 50, c("poor_er", "good_er"))
mmdat <- mmdata(samps2[["scores"]], samps2[["labels"]],
  modnames = samps2[["modnames"]], dsids = samps2[["dsids"]]
)
mmcurves <- evalmod(mmdat, raw_curves = TRUE)
prbe(mmcurves)