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
4
votes
0 answers

Issues when using randomForest in caret with ROC as optimization metric

I'm having an issue when constructing random forest models using caret. I have a dataset of about 46k rows and 10 columns (one of which is the optimization target). From this dataset, I'm trying to compare different classifiers. I did the…
random_forest_fanatic
  • 1,232
  • 1
  • 12
  • 30
4
votes
1 answer

Plot of probability of false alarm and ROC curve

How to plot a graph for false positives per window vs miss rate (or probability of false alarm) and ROC (receiver operating curve) for an object detection application using video?How to determine the number of false positives and hits?An example…
Shreya M
  • 107
  • 1
  • 2
  • 11
3
votes
2 answers

Problem with scale_x_reverse in ggplot with ROC curve

I tried plotting my ROC curve using the following code: library(titanic) library(pROC) library(ggplot2) r <- roc(Survived ~ Fare, data = titanic_train) #AUC text auc <- auc(r) ci <- ci.auc(r) ci_l <- round(ci[1], 2) ci_u <- round(ci[3],…
user19745561
  • 145
  • 10
3
votes
1 answer

CODE FOR 95% confidence intervals for sensitivity and specificity using confusion matrix

I have a 5 variable data set called EYETESTS. The variables are MAD, SAD, RED, BLUE, LEVEL. MAD, SAD, RED AND BLUE AND LEVEL are all factor variables with 2 factors that represent yes(1) or…
3
votes
1 answer

How to get the ROC curve of a neural network?

I'm trying to get the ROC curve for my Neural Network. My network uses pytorch and im using sklearn to get the ROC curve. My model outputs the binary right and wrong and also the probability of the output. output = model(batch_X) _, pred =…
Samuel Fipps
  • 193
  • 1
  • 13
3
votes
0 answers

Why does OvO and OvR return the same result?

I'm using scikit-learn's roc_auc_score() function for a multiclass classification problem. With iris which has three labels (and another dataset), I'm getting the exact same output when I use one-vs-one and one-vs-rest. Does anyone know why this is…
3
votes
2 answers

Plotting the ROC curve for a multiclass problem

I am trying to apply the idea of sklearn ROC extension to multiclass to my dataset. My per-class ROC curve looks find of a straight line each, unline the sklearn's example showing curve's fluctuating. I give an MWE below to show what I mean: # all…
user12587364
3
votes
2 answers

Create ROC curve manually from data frame

I have the below conceptual problem which I can't get my head around. Below is an example for survey data where I have a time column that indicates how long someone needs to respond to a certain question. Now, I'm interested in how the amount of…
deschen
  • 10,012
  • 3
  • 27
  • 50
3
votes
1 answer

random forest: predict vs predict_proba

I am working on a multiclass, highly imbalanced classification problem. I use random forest as base classifier. I would have to give report of model performance on the evaluation set considering multiple criteria (metrics: precision, recall…
arilwan
  • 3,374
  • 5
  • 26
  • 62
3
votes
1 answer

Difference between sklearn.roc_auc_score() and sklearn.plot_roc_curve()

I'd like to evaluate my machine learning model. I computed the area under the ROC curve with roc_auc_score() and plotted the ROC curve with plot_roc_curve() functions of sklearn. In the second function the AUC is also computed and shown in the plot.…
hafnerl
  • 123
  • 1
  • 5
3
votes
1 answer

How this method or formula for calculating ROC AUC works?

I was trying to calculate the AUC using MySQL for the data in table like below: y p 1 0.872637 0 0.130633 0 0.098054 ... ... 1 0.060190 0 0.110938 I came across the following SQL query which is giving the correct AUC score (I verified…
Aditya Jain
  • 129
  • 1
  • 5
3
votes
2 answers

ROC curve for the testing set using Caret package

I am trying to obtain ROC curve for the best model from caret on the test set. I came across MLeval package which seems to be handy (the output is very thorough, providing all the needed metrics with graphs using few lines of code). A nice example…
Bahi8482
  • 489
  • 5
  • 15
3
votes
2 answers

How to plot the ROC curve for ANN for 10 fold Cross validation in Keras using Python?

I was just trying to find ROC plot for all the 10 experiments for 10 fold cross-validation for ANN in Keras. I got stuck with it for a week and can not find a solution. Could anyone help with this? I have tried the code from the following…
3
votes
1 answer

ROC Curve in R with rpart for a decision tree

I have an issue with creating a ROC Curve for my decision tree created by the rpart package. My goal was to predict "y" the success of the bank's marketing campaign. In the end, you can get a "yes" or a "no" as a possible answer. How can I…
Meax
  • 31
  • 1
  • 2
3
votes
1 answer

How to plot AUC ROC for different caret training models?

Here's a reprex library(caret) library(dplyr) set.seed(88, sample.kind = "Rounding") mtcars <- mtcars %>% mutate(am = as.factor(am)) test_index <- createDataPartition(mtcars$am, times = 1, p= 0.2, list = F) train_cars <-…
bolleke
  • 151
  • 8