cvAUC {cvAUC} | R Documentation |
Cross-validated Area Under the ROC Curve (AUC)
Description
This function calculates cross-validated area under the ROC curve (AUC) esimates. For each fold, the empirical AUC is calculated, and the mean of the fold AUCs is the cross-validated AUC estimate. The area under the ROC curve is equal to the probability that the classifier will score a randomly drawn positive sample higher than a randomly drawn negative sample. This function is a simple wrapper for the AUC functionality inside the ROCR package.
Usage
cvAUC(predictions, labels, label.ordering = NULL, folds = NULL)
Arguments
predictions |
A vector, matrix, list, or data frame containing the predictions. |
labels |
A vector, matrix, list, or data frame containing the true class labels. Must have the same dimensions as |
label.ordering |
The default ordering of the classes can be changed by supplying a vector containing the negative and the positive class label (negative label first, positive label second). |
folds |
If specified, this must be a vector of fold ids equal in length to |
Details
If predictions
and labels
are provided as vectors and folds
is NULL
, then this function will return AUC (not cross-validated). See the documentation for the prediction
function in the ROCR package for details on the predictions
, labels
and label.ordering
arguments.
Value
perf |
An object of class 'performance' from the |
fold.AUC |
A vector containing the AUC estimate for each fold. |
cvAUC |
Cross-validated area under the curve. |
Author(s)
Erin LeDell oss@ledell.org
References
Tobias Sing, Oliver Sander, Niko Beerenwinkel, and Thomas Lengauer. ROCR: Visualizing classifier performance in R. Bioinformatics, 21(20):3940-3941, 2005.
See Also
prediction
, performance
, ci.cvAUC
, ci.pooled.cvAUC
Examples
# Example of how to get CV AUC and plot the curve.
library(cvAUC)
library(ROCR) #load example data
data(ROCR.xval)
out <- cvAUC(ROCR.xval$predictions, ROCR.xval$labels)
#Plot fold AUCs
plot(out$perf, col = "grey82", lty = 3, main = "10-fold CV AUC")
#Plot CV AUC
plot(out$perf, col ="red", avg = "vertical", add = TRUE)
# See the ci.cvAUC documentation for an example
# of how to use the `folds` argument.