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

Proper inputs for Scikit Learn roc_auc_score and ROC Plot

I am trying to determine roc_auc_score for a fit model on a validation set. I am seeing some conflicting information on function inputs. Documentation says: "y_score array-like of shape (n_samples,) or (n_samples, n_classes) Target scores. In the…
Windstorm1981
  • 2,564
  • 7
  • 29
  • 57
5
votes
1 answer

roc_auc in VotingClassifier, RandomForestClassifier in scikit-learn (sklearn)

I am trying to calculate roc_auc for hard votingclassifier that i build . i present the code with reprodcible example. now i want to calculate the roc_auc score and plot ROC curver but unfortunately i got the following error predict_proba is not…
5
votes
4 answers

How to directly plot ROC of h2o model object in R

My apologies if I'm missing something obvious. I've been thoroughly enjoying working with h2o in the last few days using R interface. I would like to evaluate my model, say a random forest, by plotting an ROC. The documentation seems to suggest that…
Ophiothrix
  • 791
  • 1
  • 8
  • 11
5
votes
2 answers

ROC curves for multiclass classification in R

I have a dataset with 6 classes and I would like to plot a ROC curve for a multiclass classification. The first answer in this thread given by Achim Zeileis is a very good one. ROC curve in R using rpart package? But this works only for a binomial…
Mahsolid
  • 433
  • 4
  • 12
  • 28
5
votes
1 answer

R: How to compute AUC and ROC curve for ´bgeva´ objekt/model?

Since I have data with binary response, but rare events, I would like to improve its forecast by fitting a bgeva model instead of a gam model. To prove and compare it´s prediction accuracy and compare it to other models that I tried, I need to…
Peky84
  • 103
  • 7
5
votes
1 answer

What does coercing the "direction" argument input in roc function (package pROC in R) do exactly?

I want to create a roc object by using the function 'roc' of pROC package in R, and plot the roc object. However, I am uncertain what the 'direction' argument does. the median predictor values of my controls is smaller than the median predictor…
layover
  • 155
  • 2
  • 6
5
votes
1 answer

not enough distinct predictions to compute area under roc

I'm tying to calculate the AUC using auc(roc(predictions, labels)), where labels is a numeric vector of 1 (x15) and 0 (x500), and predictions is a numeric vector with probabilities derived from a glm [binomial]. It should be very simple, but…
user2942623
  • 559
  • 5
  • 8
5
votes
1 answer

Binary vectors as y_score argument of roc_curve

The sklearn roc_curve docstring states: "y_score : array, shape = [n_samples] Target scores, can either be probability estimates of the positive class, confidence values, or binary decisions." In what situation it would make sense to set y_score to…
4
votes
1 answer

avoid x is neither increasing nor decreasing : {}.".format(x) when calculate auc score

So i have a list of false positive rates and a list of true positive rates obtained by varying a certain threshold. I'm trying to calculate the auc score but unfortunately i can't use roc_auc_score method from scikit-learn so i'm using the more…
JayJona
  • 469
  • 1
  • 16
  • 41
4
votes
2 answers

Plotting ROC curve for RidgeClassifier in Python

I want to plot the ROC curve for the RidgeClassifier. But the code comes with an error: I googled for solutions and it comes up to change predict_proba to predict, but it does not work! predY =…
Flodude
  • 255
  • 2
  • 12
4
votes
1 answer

Error : "Number of classes in y_true not equal to the number of columns in 'y_score'"

i have an imbalanced multiclass dataset , when i try to compute the roc_auc_score i get this error: ValueError: Number of classes in y_true not equal to the number of columns in 'y_score'. here is the code: model = svm.SVC(kernel='linear',…
4
votes
1 answer

How to draw multiple roc curves with confidence interval in pROC?

This code can draw a roc curve with confidence interval: ciobj <- ci.se(obj, specificities=seq(0, 1, l=25)) dat.ci <- data.frame(x = as.numeric(rownames(ciobj)), lower = ciobj[, 1], upper = ciobj[,…
teethdiao
  • 43
  • 1
  • 3
4
votes
0 answers

Appropriate use of ROC and AUC in keras model for multi-class, multi-label tasks

I am trying to understand the appropriate use of AUC ROC in my keras model. The specific model I am training is a multi-class, multi-lab el classifier, where each sample can belong to multiple classes. the code is as follows (starting at one-hot…
user9317212
4
votes
1 answer

How to get p value after ROC analysis with pRoc package?

After ROC analysis of a set of data, how to calculate p-value? With the same statistics, I saw that the p-value can be output in SPSS. The sample code is as follows: library(pROC) data(aSAH) head(aSAH) # gos6 outcome gender age wfns s100b …
dbcoffee
  • 173
  • 1
  • 8
4
votes
2 answers

How to plot a ROC curve from a softmax binary classifier with 2 output neurons?

How to plot the roc curve with discrete outputs labels as 2 columns? Using the roc_curve() gives me an error: ValueError: multilabel-indicator format is not supported y_prediction = model.predict(test_X) y_prediction[1] Out[27]:…
Boels Maxence
  • 349
  • 3
  • 16