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

Calculate ROC curve, classification report and confusion matrix for multilabel classification problem

I am trying to understand how to make a confusion matrix and ROC curve for my multilabel classification problem. I am building a neural network. Here are my classes: mlb = MultiLabelBinarizer() ohe = mlb.fit_transform(as_list) # loop over each of…
4
votes
1 answer

ROC curve says my predictions are worse than random but my confusion matrix says otherwise

I am working with data to classify handwritten numbers from 0 to 9. I am using PCA to reduce the dimensionality to 6 principal components and KNN to model the data. When I created the confusion matrix, I got reasonable answers out. It wasn't…
4
votes
1 answer

Use pROC package with h2o

I'm doing a binary classification with a GBM using the h2o package. I want to assess the predictive power of a certain variable, and if I'm correct I can do so by comparing the AUC of a model with the specific variable and a model without the…
Zuaro
  • 73
  • 5
4
votes
3 answers

ROC function error "Predictor must be numeric or ordered."

I am not able to get ROC function to work, I get the error "Predictor must be numeric or ordered". I've looked through other posts, but nothing solves my problem. Any help is highly appreciated. "Get…
MJ O
  • 111
  • 1
  • 1
  • 8
4
votes
3 answers

ROC curve for Isolation Forest

I am trying to plot the ROC curve to evaluate the accuracy of Isolation Forest for a Breast Cancer dataset. I calculated the True Positive rate (TPR) and False Positive Rate (FPR) from the confusion matrix. However, I do not understand how the TPR…
Nnn
  • 191
  • 3
  • 9
4
votes
2 answers

ROC AUC value is 0

I have trained a binary classifier, but I think that my ROC curve is incorrect. This is the vector that contains labels: y_true= [0, 1, 1, 1, 0, 1, 0, 1, 0] and the second vector is the score vector y_score= [ 0.43031937, 0.09115553,…
Guizmo Charo
  • 71
  • 2
  • 10
4
votes
1 answer

R - ROC Curves/AUC Specificity vs 1-Specificity

I have created a few predictive models and I am in the process of evaluating them by looking at the ROC Curve and AUC. Currently, I have Specificity on X axis, however, when I researched ROC Curves, I saw 1 - Specificity on the X axis. What is the…
MhQ-6
  • 328
  • 3
  • 11
4
votes
1 answer

Plotting mean ROC curve for multiple ROC curves, R

I have a dataset of 100 samples, each of which has 195 mutations with their corresponding known clinical significance ("RealClass") and predicted value according to some prediction tool ("PredictionValues") For the demonstration, this is a random…
sap
  • 41
  • 1
  • 5
4
votes
2 answers

Error in performance(pred, "tpr", "fpr")

I am trying to plot an ROC curve using the ROCR package in R but am stuck with the following error: Error in performance(pred, "tpr", "fpr") : Assertion on 'pred' failed: Must have class 'Prediction', but has class 'prediction' This is the code I…
veg2020
  • 956
  • 10
  • 27
4
votes
3 answers

Plot multi-class ROC curve for DecisionTreeClassifier

I was trying to plot ROC curve with classifiers other than svm.SVC which is provided in the documentation. My code works good for svm.SVC; however, after I switched to KNeighborsClassifier, MultinomialNB, and DecisionTreeClassifier, the system keeps…
yihao ren
  • 369
  • 1
  • 4
  • 15
4
votes
2 answers

Plotting ROC Curve with Multiple Classes

I am following the documentation for plotting ROC curves for multiple classes at this link: http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html I am confused about this line in particular: y_score = classifier.fit(X_train,…
bcarmel
  • 91
  • 1
  • 1
  • 7
4
votes
1 answer

faced_wrap plot with pROC package in R (several variables)

I have three independent variable and a single binary outcome variable. I'm using pROC package for the analysis and would like to present all three ROC plots next to each other, similar to face_wrap functionality. For example, using the following…
Arnold Klein
  • 2,956
  • 10
  • 31
  • 60
4
votes
1 answer

Scikit - How to define thresholds for plotting roc curve

I have a boosted trees model and probabilities and classification for test data set. I am trying to plot the roc_curve for the same. But I am unable to figure out how to define thresholds/alpha for roc curve in scikit learn. from sklearn.metrics…
Dreams
  • 5,854
  • 9
  • 48
  • 71
4
votes
2 answers

how to compute average ROC for cross validated for multiclass

I'm recently struggling with using sklearn for my project. I wanted to build a classifier and classify my data into six groups. the total sample size was 88 then I split the data into train(66) and test(22) I did exactly as sklearn documentation…
4
votes
1 answer

add AUC by group on roc plots in R

I have roc plots for 4 groups, I want to add auc values for each group in the legend: ## draw plots basicplot <- ggplot(roc_long, aes(d = outcome, m = prediction, color = model)) + geom_roc(n.cuts = 0) + + style_roc(theme = theme_bw, xlab =…
mandy
  • 483
  • 9
  • 20