addPerformanceMetric {SummarizedBenchmark} | R Documentation

## Add a performance metric definition to a `SummarizedBenchmark` object.

### Description

This is a function to define performance metrics for benchmarking methods. The function is saved into the `performanceMetrics` slot.

### Usage

    addPerformanceMetric(object, evalMetric, assay, evalFunction = NULL)

### Arguments

`object` | A `SummarizedBenchmark` object.
`evalMetric` | A string with the name of the evaluation metric.
`assay` | A string with an assay name. Indicates the assay that should be given as input to this performance metric.
`evalFunction` | A function that calculates a performance metric. It should contain at least two arguments, query and truth, where query is the output vector of a method and truth is the vector of true values. If additional parameters are specified, they must contain default values. If NULL, the 'evalMetric' string must be the name of a predefined metric available through 'availableMetrics()$function'.

### Value

A `SummarizedBenchmark` object.

### Author(s)

Alejandro Reyes

### Examples

    data( sb )
    sb <- addPerformanceMetric(
       object=sb,
       assay="qvalue",
       evalMetric="TPR",
       evalFunction = function( query, truth, alpha=0.1 ){
           goodHits <- sum( (query < alpha) & truth == 1 )
           goodHits / sum(truth == 1)
       }
    )

[Package SummarizedBenchmark version 2.2.3 Index]