Skip to contents

Often only part of a curve matters - the low-false-positive end when every alert costs a review, or the high-recall end when a miss is expensive. part() restricts a curve to that range.

library(precrec)
library(ggplot2)

curves <- evalmod(scores = P10N10$scores, labels = P10N10$labels)

Restricting the range

partial <- part(curves, xlim = c(0, 0.25))

autoplot(partial)

The full curve stays visible in outline and the selected part is highlighted, so the region is read in context rather than in isolation.

ylim restricts the other axis, and both can be given at once.

partial_y <- part(curves, ylim = c(0.5, 1))

autoplot(partial_y)

The areas

pauc() returns the area over the restricted range.

knitr::kable(pauc(partial))
modnames dsids curvetypes paucs baselines spaucs sbaselines
m1 1 ROC 0.1006250 0.03125 0.4025000 0.125
m1 1 PRC 0.2345849 0.12500 0.9383396 0.500

paucs is the raw area, which is small simply because the range is narrow. spaucs is the standardized version, rescaled to 0 to 1 so that ranges of different widths can be compared with each other and against a full AUC.

Report the standardized one unless you have a reason not to. A partial AUC of 0.18 sounds poor and may be excellent for the quarter of the axis it covers.

Several models

part() works on any evalmod() object, so the comparison carries over.

samps <- create_sim_samples(1, 100, 100, "all")
mdat <- mmdata(samps[["scores"]], samps[["labels"]],
  modnames = samps[["modnames"]]
)

mpartial <- part(evalmod(mdat), xlim = c(0, 0.25))

knitr::kable(pauc(mpartial))
modnames dsids curvetypes paucs baselines spaucs sbaselines
random 1 ROC 0.0277000 0.03125 0.1108000 0.125
random 1 PRC 0.1257566 0.12500 0.5030262 0.500
poor_er 1 ROC 0.1208000 0.03125 0.4832000 0.125
poor_er 1 PRC 0.2091682 0.12500 0.8366726 0.500
good_er 1 ROC 0.1511000 0.03125 0.6044000 0.125
good_er 1 PRC 0.2500000 0.12500 1.0000000 0.500
excel 1 ROC 0.2284000 0.03125 0.9136000 0.125
excel 1 PRC 0.2500000 0.12500 1.0000000 0.500
perf 1 ROC 0.2500000 0.03125 1.0000000 0.125
perf 1 PRC 0.2500000 0.12500 1.0000000 0.500