Skip to content

Instantly share code, notes, and snippets.

@MilesMcBain
Forked from revodavid/simple_roc.R
Created January 17, 2017 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MilesMcBain/8c3b3cbaa5ba7cc595d371bc1c416db6 to your computer and use it in GitHub Desktop.
Save MilesMcBain/8c3b3cbaa5ba7cc595d371bc1c416db6 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