Skip to content

Instantly share code, notes, and snippets.

@sbalci
Forked from revodavid/simple_roc.R
Created December 31, 2019 08:46
Show Gist options
  • Save sbalci/b618ea9845a2f8a0a245417835d2ae96 to your computer and use it in GitHub Desktop.
Save sbalci/b618ea9845a2f8a0a245417835d2ae96 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