Questions tagged [roc]

ROC (Receiver Operating Characteristic) curve is a graphical plot comparing the true positive and false positive rates of a classifier as its discrimination threshold is varied.

Receiver Operating Characteristic curve, or ROC curve, is a graphical depiction of classifier performance that shows the trade-off between increasing true positive rates (on the vertical axis) and increasing false positive rates (on the horizontal axis) as the discrimination threshold of the classifier is varied.

The true positive rate, defined as is the the fraction of true positives out of the positives, is also called the sensitivity or recall. The false positive rate, defined as the fraction of false positives out of the negatives, is equivalent to 1 - sensitivity.

In its original form, the ROC curve was used to summarize performance of a binary classification task, although it can be extended for use in multi-class problems.

A classifier performing at chance is expected to have true positive and false positive rates that are equal, producing a diagonal line. Classifiers that exceed chance produce a curve above this diagonal. The area under the curve (or AUC) is commonly used as a summary of the ROC curve and as a measure of classifier performance. The AUC is equal to the probability that a classifier will rank a randomly chosen positive case higher than a randomly chosen negative one. This is equivalent to the Wilcoxon test of ranks.

ROC curves enable visualizing and organizing classifier performance without regard to class distributions or error costs. This can be helpful when investigating learning with skewed distributions or cost-sensitive learning.

Helpful reading includes:

Fawcett, Tom. "ROC graphs: Notes and practical considerations for researchers." Machine Learning 31 (2004): 1-38.

Swets, John A., Robyn M. Dawes, and John Monahan. "Better decisions through Science." Scientific American (2000): 83.

1076 questions
3
votes
1 answer

ROC curve for discrete classifier using scikit learn

I'm having a little trouble conceptually understanding how the ROC function in scikit learn generates the true positive and false positive rates. I used the BC scikit learn data and built a decision tree around 2 random features. from…
Olivier
  • 321
  • 2
  • 11
3
votes
1 answer

How to create ROC , FAR , FRR in CNN Keras model?

I am working on my final project, Face recognition using CNN, I am new in this field and looking for advice. I already build the CNN model in Keras and train it on Faces94 and I got an accuracy of 90.97% Now, I am trying to plot CRO, FAR, FRR. I…
3
votes
1 answer

compare the auc of four ROC curves in r

I want to compare the auc of four roc curves in R. I tried roc.test , but this function can just compare two curves roc.test(roc1,roc2) Does R have a function to compare four curves? I know in stata I can compare 4 curves by roccomp. Does any one…
mandy
  • 483
  • 9
  • 20
3
votes
2 answers

R package pROC always reports AUC > 0.5

Both pROC::auc(0:1, 1:0) pROC::auc(0:1, 0:1) give an AUC of 1.. With more experiments, it seems that it always returns max(AUC, 1 - AUC). Is there an option to change this? I can't find a GitHub repo to report this issue.
F. Privé
  • 11,423
  • 2
  • 27
  • 78
3
votes
1 answer

ROC curve for Training set and Test set for each fold of cross validation in Caret

Is it possible to have ROC curve for training set and test set separately for each fold in 5 fold cross validation in Caret? library(caret) train_control <- trainControl(method="cv", number=5,savePredictions = TRUE,classProbs = TRUE) output <-…
ch.elahe
  • 289
  • 4
  • 18
3
votes
1 answer

Plot multiple ROC curves with ggplot2 in different layers

I am trying to plot multiple ROC curves on a single plot with ggplot2. Here is how far I got: ggroc2 <- function(columns, data = mtcars, classification = "am", interval = 0.2, breaks = seq(0, 1, interval)){ require(pROC) …
naco
  • 373
  • 1
  • 3
  • 14
3
votes
1 answer

Operations on a calculated .BY in data.table

As an extension of this question, I'd like to run calculations that include a .BY variable that is itself the product of a calculation. The questions I've reviewed use a key that merely accesses, but does not transform or aggregate, an existing…
C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134
3
votes
0 answers

Calculating AUC for a glm model on data imputed using the MICE package

On a regular dataset, the calls will go like this: library(ROCR) mymodelFit1 <- glm(data = myData, Outcome~ predictor1+ predictor2+ predictor3, family = binomial(link = "logit"))) prob <- predict(mymodelFit1, newdata=myData,…
Wael Hussein
  • 135
  • 1
  • 12
3
votes
1 answer

How can I generate a plot of positive predictive value (PPV) vs various cut-off points for classifications?

I have generated some scores to help predict whether or not something is yes (1) or no (0), let's say the data consists of: scores = c(10:20) response = c(0,0,1,0,1,0,1,1,0,1,1) mydata = data.frame(scores, response) I can do an ROC analysis,…
CineyEveryday
  • 127
  • 1
  • 8
3
votes
2 answers

diffrent result in every run when using xgboost model in caret package

I have unbalanced dataset (6% positive), I have used and xgboost model from caret package. this is my code: gbmGrid <- expand.grid(nrounds = 50, eta = 0.4, max_depth = 2, gamma =…
user7307305
3
votes
1 answer

Plot a ROC curve in R without using any packages

Hi i am pretty new to programming in R and i am having troble plotting a ROC curve without using any package. I generated my data using: d=rpearsonIII(100,0.5,360,20) nd=rnorm(100,450,25) i need a vector with values <400 for d and >400 for nd, so…
xpotion
  • 47
  • 1
  • 8
3
votes
0 answers

Ways of Trading Off Precision and Recall in Neural Networks

I have seen threads with similar questions/problems but I have not found this very issue. Suppose I train a NN with following cost function: J(theta) = 1/m * sum(sum( -y * log(h(x)) - ( 1 - y ) * log(1-h(x)) )) and also use sigmoid function as…
WolfgangG
  • 29
  • 2
3
votes
1 answer

Calculate cutoff and sensitivity for specific values of specificity?

After calculating several regression models, I want to calculate sensitivity-values and the cut-off for pre-specified values of specificity (i.e, 0.99, 0.90, 0.85 and so on) to find the best model. I have created code to calculate sensitivity and…
Hed
  • 33
  • 3
3
votes
3 answers

Python, Roc curves and ggplot?

I followed a tutorial for displaying the roc curves and the corresponding auc; I never used the ggplot library, thus I cannot understand where is my error. Here the code below: from sklearn import metrics import pandas as pd from ggplot…
ElenaPhys
  • 443
  • 2
  • 5
  • 16
3
votes
1 answer

R: Error "incorrect number of subscripts on matrix" when trying boot with roc

I am using Rstudio, and trying to use roc from package pROC with boot for bootstrapping. I am following the code on this link. Code from that link uses another function with boot which works fine. But when I try roc, it gives error. Below is my…
dc95
  • 1,319
  • 1
  • 22
  • 44