calcPerformance: Add Performance Calculations to a ClassifyResult object

Description Usage Arguments Details Value Author(s) Examples

Description

Annotates the results of calling runTests with different kinds of performance measures.

Usage

1
2
  ## S4 method for signature 'ClassifyResult'
calcPerformance(result, performanceType, ...)

Arguments

result

An object of class ClassifyResult.

performanceType

Either "balanced", "sample error", "sample accuracy" or one of the options provided by performance.

...

Further arguments that may be used by performance.

Details

Most performance metrics are provided by ROCR, so only work for two-class datasets. If runTests was run in resampling mode, one performance measure is produced for every resampling. If the leave-out mode was used, then the predictions are concatenated, and one performance measure is calcuated for all classifications.

A variety of other metrics are also implemented in ClassifyR and are suitable for evaluating a multi-class classification. "balanced" calculates the balanced error rate and is better suited to class-imbalanced datasets than the ordinary error rate. "sample error" calculates the error rate of each sample individually. This may help to identify which samples are contributing the most to the error rate. "sample accuracy" causes the sample-wise accuracy to be computed.

Value

An updated ClassifyResult object, with new information in the performance slot.

Author(s)

Dario Strbenac

Examples

1
2
3
4
5
6
7
8
9
  predictTable <- data.frame(sample = 1:10,
                             label = factor(sample(LETTERS[1:2], 50, replace = TRUE)))
  actual <- factor(sample(LETTERS[1:2], 10, replace = TRUE))                             
  result <- ClassifyResult("Example", "Differential Expression", "A Selection",
                           paste("A", 1:10, sep = ''), paste("Gene", 1:50, sep = ''),
                           list(1:50, 1:50), list(1:5, 6:15),
                           list(predictTable), actual, list("leave", 2))
  result <- calcPerformance(result, "balanced") 
  performance(result)

ClassifyR documentation built on Nov. 17, 2017, 1:42 p.m.