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

ROC curve for classification from randomForest

I am using randomForest package in R platform for classification task. rf_object<-randomForest(data_matrix, label_factor, cutoff=c(k,1-k)) where k ranges from 0.1 to 0.9. pred <- predict(rf_object,test_data_matrix) I have the output from the…
Abhishek
  • 279
  • 2
  • 5
  • 18
6
votes
1 answer

Does calibration improve roc score?

I'm studing the effects of performing a calibrated classifier and I read that the aim of calibrating is to make a classifier's prediction more 'reliable'. With this in mind I think that a calibrated classifier would have a higher score…
Moreno
  • 608
  • 1
  • 9
  • 24
6
votes
1 answer

Keras, auc on validation set during training does not match with sklearn auc

I am using my test set as a validation set. I used similar approach as How to compute Receiving Operating Characteristic (ROC) and AUC in keras? The issue is that my val_auc during the training is around 0.85, how ever, when I use fpr, tpr, _ =…
Behinoo
  • 395
  • 5
  • 18
6
votes
2 answers

Manually calculate AUC

How can I obtain the AUC value having fpr and tpr? Fpr and tpr are just 2 floats obtained from these formulas: my_fpr = fp / (fp + tn) my_tpr = tp / (tp + fn) my_roc_auc = auc(my_fpr, my_tpr) I know this can't pe possible, because fpr and tpr are…
user9370613
6
votes
0 answers

Common way to plot a ROC Curve

I'm trying to obtain ROC Curve for GBTClassifier. One way is to reuse BinaryClassificationMetrics, however the path given in the documentation (https://spark.apache.org/docs/latest/mllib-evaluation-metrics.html) provides only 4 values for the ROC…
Igor Kustov
  • 787
  • 1
  • 8
  • 21
6
votes
1 answer

Random Forests and ROC Curves in Julia

I'm using the ScikitLearn flavour of the DecisionTree.jl package to create a random forest model for a binary classification problem of one of the RDatasets data sets (see bottom of the DecisionTree.jl home page for what I mean by ScikitLearn…
lara
  • 835
  • 1
  • 8
  • 20
6
votes
1 answer

How to optimize precision-recall curve instead of AUC-ROC curve in python scikit-learn?

I am asking a follow-up question as suggested from my previous post - Good ROC curve but poor precision-recall curve. I am only using the default setting with Python scikit-learn. It seems like the optimization is on AUC-ROC, but I am more…
KubiK888
  • 4,377
  • 14
  • 61
  • 115
6
votes
2 answers

ROC curve in R using rpart package?

I split Train data set and Test data set. I used a package rpart for CART (classification tree) in R (only train set). And I want to carry out a ROC analysis using the ROCR package. Variable is `n. use' (response varible... 1=yes, 0=no): > Pred2 =…
yuri
  • 61
  • 1
  • 1
  • 3
6
votes
1 answer

How to plot a ROC curve using ROCR package in r, *with only a classification contingency table*

How to plot a ROC curve using ROCR package in r, with only a classification contingency table? I have a contingency table where the true positive, false positive.. etc. all the rated can be computed. I have 500 replications, therefore 500 tables.…
William Liu
  • 339
  • 1
  • 2
  • 9
6
votes
1 answer

sklearn svm area under ROC less than 0.5 for training data

I am using sklearn v 0.13.1 svm in order to try and solve a binary classification problem. I use kfold cross validation and compute the area under the roc curve (roc_auc) to test the quality of my model. However, for some folds the roc_auc is less…
user3276811
  • 61
  • 1
  • 2
6
votes
3 answers

How to deal with multiple class ROC analysis in R (pROC package)?

When I use multiclass.roc function in R (pROC package), for instance, I trained a data set by random forest, here is my code: # randomForest & pROC packages should be installed: # install.packages(c('randomForest',…
zhaoyin.usm
  • 251
  • 1
  • 6
  • 10
6
votes
1 answer

KNN classification in MATLAB - confusion matrix and ROC?

I'm trying to classify a data set containing two classes using different classifiers (LDA, SVM, KNN) and would like to compare their performance. I've made ROC curves for the LDA by modifying the priori probability. But how can i do the same for a…
user1865820
  • 186
  • 1
  • 12
6
votes
2 answers

Is it OK if the false positive rate in a ROC curve does not end in 1.0?

I have the following ROC Curve: And it does not end in 1.0 because my predictions include zeros, for example prediction = [0.9, 0.1, 0.8, 0.0] For the ROC Curve, I take the top-k predictions, first {0.9}, then {0.9, 0.8} etc. And if there are no…
Puckl
  • 731
  • 5
  • 19
5
votes
2 answers

Calculating AUC ratio in R

I am generating ecological niche models for a set of species and I would like to use AUC as a metric for ecological niche quality. Steven Phillips, who developed Maxent, provides code in his Maxent manual for calculating the AUC in R. However, I am…
Pascal
  • 1,590
  • 2
  • 16
  • 35
5
votes
1 answer

Error message with sklearn function " 'RocCurveDisplay' has no attribute 'from_predictions' "

I am trying to use the sklearn function RocCurveDisplay.from_predictions as presented in https://scikit-learn.org/stable/modules/generated/sklearn.metrics.RocCurveDisplay.html#sklearn.metrics.RocCurveDisplay.from_predictions. I run the function like…
Julithe
  • 53
  • 1
  • 1
  • 3