Skip to content

Instantly share code, notes, and snippets.

@revodavid
Created August 2, 2016 15:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save revodavid/7d31e678cfd5dddfc8064768dcb33a1b to your computer and use it in GitHub Desktop.
Save revodavid/7d31e678cfd5dddfc8064768dcb33a1b 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