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
2
votes
1 answer

ROC curve 3 class classification with Matlab

I have to plot ROC using Matlab but my data set including 3 classes and most of examples are for 2 classes. How can I plot ROC for 3 classes (e.g. the fisher iris data set)?
m_besmek
  • 41
  • 4
2
votes
1 answer

Plotting Multiclass ROC Curve

I'm new to SciKit and Python. Currently I am trying to generate a multiclass (3 classes) ROC curve from csv file that looks like this: probability,predclass,dist0,dist1,dist2,actualclass …
2
votes
1 answer

ROC in Multiclass kNN

Im trying to run some ROC analysis on a multiclass knn model and dataset so far i have this code for the kNN model. It works well. X_train_new is a dataset with 131 numeric variables (columns) and 7210 observations. Y_train is the outcome variable…
Andres Mora
  • 1,040
  • 8
  • 16
2
votes
1 answer

Limiting decimals of AUC to be printed with with ROC curve in pROC

I have successfully created a plot with multiple ROC curves of different prediction models in the same plot and the numerical value of the AUC and CI is printed nicely on the side. However it makes no sense for my project to have these printed with…
mmo
  • 25
  • 5
2
votes
0 answers

Sample size calculation from two ROC curves with a different ratio of cases to controls than sample data

I'm trying to compare two AUC values, for sample size calculation in the pROC package. The package takes inputs roc1 and roc2 and determines the number of cases and controls from those curves. I would like to use those curves as input, and calculate…
Gmiller
  • 33
  • 6
2
votes
0 answers

How can I plot the average ROC of a bootstrap of cross-validated BRT models (gbm.step) in R with confidence intervals?

I would like to produce a ROC curve from 100 runs of a 10-fold cross validated model produced with gbm.step from the gbm and dismo packages, with the curve representing the average and also displaying the confidence interval, something like this…
westpier
  • 45
  • 3
2
votes
1 answer

sklearn multiclass roc auc score

How to get the roc auc score for multi-class classification in sklearn? binary # this works roc_auc_score([0,1,1], [1,1,1]) multiclass # this fails from sklearn.metrics import roc_auc_score ytest = [0,1,2,3,2,2,1,0,1] ypreds =…
BhishanPoudel
  • 15,974
  • 21
  • 108
  • 169
2
votes
1 answer

What prediction format should be the input for ROC function

I am trying to calculate the ROC of a target variable that is binary(0,1) versus a decision tree prediction. When I set the prediction value to be binary, it gives me the following error: > roc(as.numeric(pred),as.numeric(data$target)) Setting…
Yovo Zhang
  • 23
  • 2
2
votes
2 answers

FROC Implementation in Python

I have one system which predicts the location of boxes in the page. In the image below, the green rectangular is the correct location (label) and the red ones are the predicted. It is clear that the best performance of the system is when all red…
Magi
  • 341
  • 2
  • 15
2
votes
4 answers

How to calculate TPR and FPR in Python without using sklearn?

Initialize the list of lists: data = [[1.0, 0.635165,0.0], [1.0, 0.766586,1.0], [1.0, 0.724564,1.0], [1.0, 0.766586,1.0],[1.0, 0.889199,1.0],[1.0, 0.966586,1.0], [1.0, 0.535165,0.0],[1.0, 0.55165,0.0],[1.0, 0.525165,0.0], …
Sahil Kamboj
  • 390
  • 2
  • 5
  • 16
2
votes
2 answers

Keras ROC different from Scikit ROC?

From the code below, it looks like evaluating the roc with keras and with scikit actually makes a difference. Does anybody know an explanation? import tensorflow as tf from keras.layers import Dense, Input, Dropout from keras import…
ClaMor
  • 51
  • 4
2
votes
2 answers

decision_function and precidt_proba yield different ROC graphs in sklearn

I'm following the ROC graph example given in sklearn docs here (you can download a Jupyter notebook from here). It generates a ROC graph for the multi-class problem over the Iris dataset. In the original example, the predictions are generated using…
shakedzy
  • 2,853
  • 5
  • 32
  • 62
2
votes
2 answers

Different result roc_auc_score and plot_roc_curve

I am training a RandomForestClassifier (sklearn) to predict credit card fraud. When I then test the model and check the rocauc score i get different values when I use roc_auc_score and plot_roc_curve. roc_auc_score gives me around 0.89 and the…
2
votes
1 answer

Python metrics ROC curve: negative predictive value for a histogram?

I have a histogram generated by matplotlib and i have been using sklearn metrics to calculate the precision-recall curve. This is a plot showing the positive predictive value (PPV) of a histogram in dependency of the recall. This is the…
sussko
  • 101
  • 1
  • 1
  • 4
2
votes
1 answer

How to plot average ROC and AUC in Python?

I need to perform a classification of users using binary classification (User 1 or 0 in each case). I have 30 users and there are 30 sets of FPR and TPR. I did not use roc_curve(y_test.ravel(), y_score.ravel()) to get FPR and TPF (there is a reason…
Jaya A
  • 145
  • 1
  • 8