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

Understanding the what is returned by the performance() function of ROCR - in Classification in R

I have difficulty understanding what is returned by the performance() function of the ROCR package. Let me be concrete with a reproducible example. I use the mpg dataset. My code is the…
rf7
  • 1,993
  • 4
  • 21
  • 35
4
votes
1 answer

Why does my ROC curve look like a V?

newpred <- c(1, 0 ,0 ,1 ,0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0,0, 1, 0, 0, 0, 0,0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0,…
L.Sobble
  • 49
  • 1
  • 10
4
votes
3 answers

pROC ROC curves remove empty space

I want to draw ROC curves with pRoC. However for some reason there is extra empty space on either side of the x-axis and I cannot remove it with xlim. Some example code: library(pROC) n = c(4, 3, 5) b = c(TRUE, FALSE, TRUE) df = data.frame(n, b)…
Hendrik
  • 135
  • 2
  • 8
4
votes
3 answers

R: Plot multiple different coloured ROC curves using ROCR

The following code was taken from @adibender answer to "Multiple ROC curves in one plot ROCR". The code is partly from ?plot.performance. library(ROCR) data(ROCR.simple) preds <- cbind(p1 = ROCR.simple$predictions, p2 =…
warnbergg
  • 552
  • 4
  • 14
4
votes
0 answers

How to plot ROC-curve in sklearn for LASSO method?

I want to compare lasso with other classifiers in sklearn. I have a binary outcome vector y. I usually compute a vector probas that contains the predicted probability for each input point to have 1 as a phenotype and then generate a ROC curve fro…
Fringant
  • 525
  • 1
  • 5
  • 17
4
votes
1 answer

Error with prediction - ROCR package (using probabilities)

I have used "rfe" function with svm to create a model with reduced features. Then I use "predict" on test data which outputs class labels (binary), 0 class probabilities, 1 class probabilities. I then tried using prediction function, in ROCR…
tacqy2
  • 309
  • 1
  • 5
  • 12
4
votes
2 answers

How to use prediction score in creating ROC curve with Scikit-Learn

I have the following code: from sklearn.metrics import roc_curve, auc actual = [1,1,1,0,0,1] prediction_scores = [0.9,0.9,0.9,0.1,0.1,0.1] false_positive_rate, true_positive_rate, thresholds = roc_curve(actual, prediction_scores,…
neversaint
  • 60,904
  • 137
  • 310
  • 477
4
votes
1 answer

How to Plot ROC curve with matplotlib/python

I want to plot a ROC curve in python with matplotlib and want to show it like this: Say we have 0.0 to 1.0 predictions y_score and binary 0 or 1 labels y_test how to we convert this to a ROC curve? I cannot find a function which do something like…
Brainfail
  • 196
  • 1
  • 2
  • 11
4
votes
2 answers

How can I switch the ROC curve to optimize false negative rate?

ROC curves plot TPR vs. FPR and vary the thresholds based on the rank order of the probabilities of the training set. The threshold that is picked is the probability associated with the point in the top left hand most corner. That basically…
SriK
  • 1,011
  • 1
  • 15
  • 29
4
votes
1 answer

ROC curve shows strange pattern

I have a dataset to which I add 10-30% of artificial data and run an algorithm to classify what data is original and what artificial. I got the attached ROC curves. I've never seen ROC curves ending like that. Am I doing something wrong? Or such…
user1883163
  • 133
  • 9
4
votes
1 answer

"ROC" metric not in result set

I'm trying to produce a random forest model with the caret package, using area under the ROC curve as the train metric, but I get the following warning: Warning message: In train.default(x = TrainData, y = TrainClasses, method = "rf", : The…
vorpalwabbit
  • 65
  • 1
  • 6
4
votes
1 answer

Scikit Learn Algorithm has incorrect predictions but ROC curve is perfect?

Its my first time using scikit learn metrics and I want to graph a roc curve using this library. This ROC curve says the AUC=1.00 which I know is incorrect. Here is the code: from sklearn.metrics import roc_curve, auc import pylab as pl def…
4
votes
1 answer

ROC curve for a binary classifier in MATLAB

I have a binary classifier, which classifies an input X as class zero if its predicted value is below some threshold (say T), and one otherwise. I have all predicted and actual values for every input. So I can have both predicted class and actual…
Matin Kh
  • 5,192
  • 6
  • 53
  • 77
4
votes
1 answer

Why area under curve (AUC) in ROC decreases when I use more variables?

My dataset has 400 observations of 100 features. Each of the 400 observations belongs to 1 out of 2 classes. I am training a neural network (patternet(15)) in MATLAB for classifying this dataset. I don't use all the features at once, but first I…
glin yon
  • 99
  • 1
  • 1
  • 8
4
votes
1 answer

Possible to make a ROC plot from SVM with precomputed kernel in scikit-learn?

I'm using this example for creating ROC plot from SVM classification results: http://scikit-learn.org/0.13/auto_examples/plot_roc.html However, each data point effectively consists of 4 length-d feature vectors, combined using a custom kernel…
Magsol
  • 4,640
  • 11
  • 46
  • 68