Skip to content

Instantly share code, notes, and snippets.

@juliasilge
Forked from revodavid/simple_roc.R
Created August 3, 2016 23:53
Show Gist options
  • Save juliasilge/0fa606b9479e8e96bdfdec3945d6ad57 to your computer and use it in GitHub Desktop.
Save juliasilge/0fa606b9479e8e96bdfdec3945d6ad57 to your computer and use it in GitHub Desktop.
simple_roc <- function(labels, scores){
labels <- labels[order(scores, decreasing=TRUE)]
data.frame(TPR=cumsum(labels)/sum(labels), FPR=cumsum(!labels)/sum(!labels), labels)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment