computeROCandAUC {kebabs} | R Documentation

## 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

### Details

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

### 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.

### Author(s)

Johannes Palme <kebabs@bioinf.jku.at>

### 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: 10.1093/bioinformatics/btv176.

### See Also

`predict`, `ROCData`

### Examples

    ## 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)

[Package kebabs version 1.24.0 Index]