computeROCandAUC {kebabs} | R Documentation |
Compute the receiver operating characteristic (ROC) and area under the ROC curve (AUC) as performance measure for binary classification
computeROCandAUC(prediction, labels, allLabels = NULL)
prediction |
prediction results in the form of decision values as
returned by |
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 |
For binary classfication this function computes the receiver operating curve (ROC) and the area under the ROC curve (AUC).
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.
Johannes Palme <kebabs@bioinf.jku.at>
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: 10.1093/bioinformatics/btv176.
## 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 ## Not run: ## plot ROC plot(rocdata) ## End(Not run)