Nothing
rocStats <-
function(outputs, groundTruthLabels, decreasing = TRUE) {
## ROCSTATS Make ROC curve data.
## FORMAT
## DESC Computes the points on an ROC curve by varying a threshold on the
## sorted outputs of the method in question.
## ARG outputs : The outputs of the evaluated method (eg. likelihoods).
## ARG groundTruthLabels: Binary vector than contains the ground truth.
## ARG decreasing : (LOGICAL) Outputs are sorted by decreazing or increazing order.
## RETURN stats : List that containts the necessary statistics to generate
## the ROC curve and other curves such as precision-recall.
##
## USAGE : rocStats(outputs, groundTruthLabels, descreasing=TRUE)
##
## COPYRIGHT : Alfredo Kalaitzis, 2010, 2011
##
## GPREGE
index <- sort(outputs, decreasing=decreasing, index.return=TRUE)$ix
sLabels <- groundTruthLabels[index] ## Sorted ground truth labels.
P <- sum(sLabels) ## Total positives.
N <- sum(!sLabels) ## Total negatives.
TP <- cumsum(sLabels) ## Want this to increase fast as we progress through the ranks.
FP <- cumsum(!sLabels) ## Want this to stay as low as possible as we progress through the ranks.
TN <- N-FP
FN <- P-TP
stats <- list()
stats$FDR = FP/(FP+TP)
stats$FNR = FN/(FN+TP)
stats$Precision = TP/(TP+FP)
stats$Recall = TP/(TP+FN)
stats$TPR = stats$Recall
stats$FPR = FP/(FP+TN)
stats$TP = TP
stats$FP = FP
return(stats)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.