Trapezoid integration of Recall (x-axis) vs Precision (y-axis), analogous to ms_bench_auc for ROC curves.

ms_bench_ap(recall, precision, recall_threshold = 1)

Arguments

recall

array of Recall (TPR) values

precision

array of corresponding Precision values

recall_threshold

max recall to integrate to (default 1)

Value

numeric AP score (0-100 scale)

Examples

recall <- c(0, 0.2, 0.4, 0.6, 0.8, 1.0)
precision <- c(1.0, 0.9, 0.85, 0.8, 0.7, 0.6)
ap <- ms_bench_ap(recall, precision)
#> Error in ms_bench_ap(recall, precision): could not find function "ms_bench_ap"
stopifnot(is.numeric(ap), length(ap) == 1, ap > 0)
#> Error: object 'ap' not found