Skip to main content

Compute Average Precision (area under Precision-Recall curve)

Description

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

Usage

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)

See Also

Other benchmarking: Benchmark, benchmark_from_file(), benchmark_from_result(), collect_benchmark_results(), ionstar_bench_preprocess(), make_benchmark(), ms_bench_add_scores(), ms_bench_auc(), plot_benchmark_comparison(), read_benchmark_results(), read_contrast_results(), write_benchmark_results(), write_contrast_results()

Examples

library("prolfquabenchmark")

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)
stopifnot(is.numeric(ap), length(ap) == 1, ap > 0)