The aim of the prcbench package is to provide a testing workbench for evaluating precision-recall curves under various conditions. It contains integrated interfaces for the following five tools. It also contains predefined test data sets.

Tool Link
ROCR Tool web site, CRAN
AUCCalculator Tool web site
PerfMeas CRAN
PRROC CRAN
precrec Tool web site, CRAN

Dependencies

Java

AUCCalculator requires a Java runtime (>= 6).

Bioconductor libraries

PerfMeas requires Bioconductor libraries. To automatically install the dependencies, add a Bioconductor repository to the repository list as:

## Include a Bioconductor repository
setRepositories(ind = 1:2)

Installation

Potential installation issues

Bioconductor libraries

You can manually install the dependencies from Bioconductor if install.packages fails to access the Bioconductor repository.

## try http:// if https:// URLs are not supported
source("https://bioconductor.org/biocLite.R")
biocLite("limma")
biocLite("graph")
biocLite("RBGL")

rJava

Some OSs require further configuration for rJava.

Use:

Sys.setenv(JAVA_HOME = "<path to JRE>")

or

#!/bin/bash

export JAVA_HOME = "<path to JRE>"
R CMD javareconf

microbenchmark

microbenchmark does not work on some OSs. prcbench uses system.time when microbenchmark is not available.

Documentation

Examples

Following two examples show the basic usage of prcbench functions.

Benchmarking

The run_benchmark function outputs the result of microbenchmark for specified tools.

## Load library
library(prcbench)

## Run microbenchmark for aut5 on b10
testset <- create_testset("bench", "b10")
toolset <- create_toolset(set_names = "auc5")
res <- run_benchmark(testset, toolset)

## Use knitr::kable to show the result in a table format
knitr::kable(res$tab, digits = 2)
testset toolset toolname min lq mean median uq max neval
b10 auc5 ROCR 1.64 1.65 19.26 1.66 28.69 62.65 5
b10 auc5 AUCCalculator 3.07 4.45 10.41 5.28 5.49 33.76 5
b10 auc5 PerfMeas 0.06 0.07 87.74 0.07 0.10 438.38 5
b10 auc5 PRROC 0.17 0.17 1.99 0.19 0.21 9.21 5
b10 auc5 precrec 3.98 4.03 22.96 4.06 4.10 98.62 5

Evaluation of precision-recall curves

The run_evalcurve function evaluates precision-recall curves with predefined test datasets. The autoplot shows a plot with the result of the run_evalcurve function.

## ggplot2 is necessary to use autoplot
library(ggplot2)

## Plot base points and the result of precrec on c1, c2, and c3 test sets
testset <- create_testset("curve", c("c1", "c2", "c3"))
toolset <- create_toolset("precrec")
scores1 <- run_evalcurve(testset, toolset)
autoplot(scores1)
## Plot the results of PerfMeas and PRROC on c1, c2, and c3 test sets
toolset <- create_toolset(c("PerfMeas", "PRROC"))
scores2 <- run_evalcurve(testset, toolset)
autoplot(scores2, base_plot = FALSE)

Citation

Precrec: fast and accurate precision-recall and ROC curve calculations in R

Takaya Saito; Marc Rehmsmeier

Bioinformatics 2017; 33 (1): 145-147.

doi: 10.1093/bioinformatics/btw570