Learn R Programming

kebabs (version 1.6.2)

computeROCandAUC: Compute Receiver Operating Characteristic And Area Under The Curve

Description

Compute the receiver operating characteristic (ROC) and area under the ROC curve (AUC) as performance measure for binary classification

Usage

computeROCandAUC(prediction, labels, allLabels = NULL)

Arguments

prediction
prediction results in the form of decision values as returned by predict for predictionType="decision".
labels
label vector of same length as parameter 'prediction'.
allLabels
vector containing all occuring labels once. This parameter is required only if the labels parameter is not a factor. Default=NULL

Value

  • On successful completion the function returns an object of class ROCData containing the AUC, a numeric vector of TPR values and a numeric vector containing the FPR values. If the ROC and AUC cannot be computed because of missing positive or negative samples the function returns 3 NA values.

Details

For binary classfication this function computes the receiver operating curve (ROC) and the area under the ROC curve (AUC).

References

http://www.bioinf.jku.at/software/kebabs J. Palme, S. Hochreiter, and U. Bodenhofer (2015) KeBABS: an R package for kernel-based analysis of biological sequences. Bioinformatics, 31(15):2574-2576, 2015. DOI: http://dx.doi.org/10.1093/bioinformatics/btv176{10.1093/bioinformatics/btv176}.

See Also

predict, ROCData

Examples

Run this code
## load transcription factor binding site data
data(TFBS)
enhancerFB
## select 70\% of the samples for training and the rest for test
train <- sample(1:length(enhancerFB), length(enhancerFB) * 0.7)
test <- c(1:length(enhancerFB))[-train]
## create the kernel object for gappy pair kernel with normalization
gappy <- gappyPairKernel(k=1, m=3)
## show details of kernel object
gappy

## run training with explicit representation
model <- kbsvm(x=enhancerFB[train], y=yFB[train], kernel=gappy,
               pkg="LiblineaR", svm="C-svc", cost=80, explicit="yes",
               featureWeights="no")

## predict the test sequences
pred <- predict(model, enhancerFB[test])
## print prediction performance
evaluatePrediction(pred, yFB[test], allLabels=unique(yFB))

## compute ROC and AUC
preddec <- predict(model, enhancerFB[test], predictionType="decision")
rocdata <- computeROCandAUC(preddec, yFB[test], allLabels=unique(yFB))

## show AUC value
rocdata

## plot ROC
plot(rocdata)

Run the code above in your browser using DataLab