Questions tagged [precision-recall]

Precision and Recall are statistical measures of performance for information retrieval algorithms based on binary classification. Precision is a measure of the percent of all classifications (items retrieved) that are relevant. Recall is a measure of the percent of relevant classifications (items retrieved) successfully found by the algorithm, relative to all relevant items that exist and could have been found.

Precision and Recall are statistical measures of performance for information retrieval algorithms based on binary classification. Precision is a measure of the percent of all classifications (items retrieved) that are relevant. Recall is a measure of the percent of relevant classifications (items retrieved) successfully found by the algorithm, relative to all relevant items that exist and could have been found.

For binary classification, the fundamental quantities are the percent of True Positive, False Positive, True Negative, and False Negative classifications obtained by a classification algorithm. In the context of information retrieval, a "Positive" result is an item retrieved by the algorithm, while a "Negative" result is an item not retrieved by the algorithm.

"True" or "False" refer to whether the classification made by the algorithm was or was not in fact correct.

Infographic "Precision and recall"

Illustration File:Precisionrecall.svg (CC BY-SA) by Walber, Wikipedia

So in the context of information retrieval, "True Positive" means the percent of cases where the algorithm retrieved an item and should have, "True Negative" means the algorithm did not retrieve an item and should not have. "False Positive" means the algorithm retrieved an item and should not have, "False Negative" means the algorithm failed to retrieve an item, but should have.

Precision is defined as True Positive/(True Positive + False Positive). Thus it is a measure of the fraction of the classifications (items retrieved by the algorithm) that are correct or relevant, as a percentage of all items that the algorithm retrieves.

Recall is defined as True Positive/(True Positive + False Negative). Thus it is a measure of the fraction of the correct or relevant classifications (items retrieved by the algorithm) that were actually found, relative to the total number of relevant items.

447 questions
65
votes
4 answers

F1 Score vs ROC AUC

I have the below F1 and AUC scores for 2 different cases Model 1: Precision: 85.11 Recall: 99.04 F1: 91.55 AUC: 69.94 Model 2: Precision: 85.1 Recall: 98.73 F1: 91.41 AUC: 71.69 The main motive of my problem to predict the positive cases…
user3342643
  • 729
  • 1
  • 7
  • 7
54
votes
5 answers

How to calculate precision and recall in Keras

I am building a multi-class classifier with Keras 2.02 (with Tensorflow backend),and I do not know how to calculate precision and recall in Keras. Please help me.
Jimmy Du
  • 545
  • 1
  • 4
  • 6
40
votes
2 answers

Facing ValueError: Target is multiclass but average='binary'

I'm trying to use Naive Bayes algorithm for my dataset. I'm able to find out the accuracy but trying to find out precision and recall for the same. But, it is throwing the following error: ValueError: Target is multiclass but average='binary'.…
39
votes
1 answer

sklearn metrics for multiclass classification

I have performed GaussianNB classification using sklearn. I tried to calculate the metrics using the following code: print accuracy_score(y_test, y_pred) print precision_score(y_test, y_pred) Accuracy score is working correctly but precision score…
dino
  • 411
  • 2
  • 5
  • 10
38
votes
2 answers

What is a bad, decent, good, and excellent F1-measure range?

I understand F1-measure is a harmonic mean of precision and recall. But what values define how good/bad a F1-measure is? I can't seem to find any references (google or academic) answering my question.
KubiK888
  • 4,377
  • 14
  • 61
  • 115
35
votes
3 answers

What is a threshold in a Precision-Recall curve?

I am aware of the concept of Precision as well as the concept of Recall. But I am finding it very hard to understand the idea of a 'threshold' which makes any P-R curve possible. Imagine I have a model to build that predicts the re-occurrence (yes…
35
votes
7 answers

Computing precision and recall in Named Entity Recognition

Now I am about to report the results from Named Entity Recognition. One thing that I find a bit confusing is that my understanding of precision and recall was that one simply sums up true positives, true negatives, false positives and false…
Nick
  • 2,924
  • 4
  • 36
  • 43
32
votes
5 answers

Precision/recall for multiclass-multilabel classification

I'm wondering how to calculate precision and recall measures for multiclass multilabel classification, i.e. classification where there are more than two labels, and where each instance can have multiple labels?
32
votes
5 answers

What does recall mean in Machine Learning?

What's the meaning of recall of a classifier, e.g. bayes classifier? please give an example. for example, the Precision = correct/correct+wrong docs for test data. how to understand recall?
user1687717
  • 3,375
  • 7
  • 26
  • 29
28
votes
8 answers

Easy way of counting precision, recall and F1-score in R

I am using an rpart classifier in R. The question is - I would want to test the trained classifier on a test data. This is fine - I can use the predict.rpart function. But I also want to calculate precision, recall and F1 score. My question is - do…
Karel Bílek
  • 36,467
  • 31
  • 94
  • 149
27
votes
1 answer

How to plot precision and recall of multiclass classifier?

I'm using scikit learn, and I want to plot the precision and recall curves. the classifier I'm using is RandomForestClassifier. All the resources in the documentations of scikit learn uses binary classification. Also, can I plot a ROC curve for…
John Sall
  • 1,027
  • 1
  • 12
  • 25
27
votes
1 answer

How to interpret almost perfect accuracy and AUC-ROC but zero f1-score, precision and recall

I am training ML logistic classifier to classify two classes using python scikit-learn. They are in an extremely imbalanced data (about 14300:1). I'm getting almost 100% accuracy and ROC-AUC, but 0% in precision, recall, and f1 score. I understand…
KubiK888
  • 4,377
  • 14
  • 61
  • 115
23
votes
1 answer

Recall, Recall rate@k and precision in top-k recommendation

According to authors in 1, 2, and 3, Recall is the percentage of relevant items selected out of all the relevant items in the repository, while Precision is the percentage of relevant items out of those items selected by the query. Therefore,…
20
votes
1 answer

Accuracy, precision, and recall for multi-class model

How do I calculate accuracy, precision and recall for each class from a confusion matrix? I am using the embedded dataset iris; the confusion matrix is as below: prediction setosa versicolor virginica setosa 29 0 …
jack
  • 273
  • 3
  • 4
  • 14
1
2 3
29 30