Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Accuracy, Precision, and Recall

DZone's Guide to

Accuracy, Precision, and Recall

A mathematician and developer discusses some concepts from the field of statistics that data scientists will find interesting.

· Big Data Zone ·
Free Resource

Hortonworks Sandbox for HDP and HDF is your chance to get started on learning, developing, testing and trying out new features. Each download comes preconfigured with interactive tutorials, sample data and developments from the Apache community.

I posted the definitions of accuracy, precision, and recall on @BasicStatistics recently. I think the tweet was popular because people find these terms hard to remember and they liked a succinct cheat sheet.

Accuracy = (TP+TN)/(TP+FP+FN+TN)
Precision = TP/(TP+FP)
Recall = TP/(TP+FN)

where

T = true
F = false
P = positive
N = negative

- Basic Statistics (@BasicStatistics) September 6, 2018

There seems to be no end of related definitions, and multiple names for the same definitions.

Precision is also known as positive predictive value (PPV) and recall is also known as sensitivity, hit rate, and true positive rate (TPR).

Not mentioned in the tweet above are specificity (a.k.a. selectivity and true negative rate or TNR), negative predictive value (NPV), miss rate (a.k.a. false negative rate or FNR), fall-out (a.k.a. false positive rate or FPR), false discovery rate (FDR), and false omission rate (FOR).

How many terms are possible? There are four basic ingredients: TP, FP, TN, and FN. So if each term may or may not be included in a sum in the numerator and denominator, that's 16 possible numerators and 16 denominators, for a total of 256 possible terms to remember. Some of these are redundant, such as one (a.k.a. ONE), given by TP/TP, FP/FP, etc. If we insist that the numerator and denominator be different, that eliminates 16 possibilities, and we're down to a more manageable 240 definitions. And if we rule out terms that are the reciprocals of other terms, we're down to only 120 definitions to memorize.

But wait! We've assumed every term occurs with a coefficient of either 0 or 1. But the F1 score has a couple coefficients of 2:

F 1 = 2TP / (2TP + FP + FN)

If we allow coefficients of 0, 1, or 2, and rule out redundancies and reciprocals...

This has been something of a joke. Accuracy, precision, and recall are useful terms, though I think positive predictive value and true positive rate are easier to remember than precision and recall respectively. But the proliferation of terms is ridiculous. I honestly wonder how many terms for similar ideas are in use somewhere. I imagine there are scores of possibilities, each with some subdiscipline that thinks it is very important, and few people use more than three or four of the possible terms.

Here are the terms I've collected so far. If you know of other terms or other names for the same terms, please leave a comment and we'll see how long this table goes.

|-----------------------------------+---------------------------------|
| Name                              | Definition                      |
|-----------------------------------+---------------------------------|
| Accuracy                          | (TP + TN) / (FP + TP + FN + TN) |
| True positive rate (TPR)          | TP / (TP + FN)                  |
| Sensitivity                       | see TPR                         |
| Recall                            | see TPR                         |
| Hit rate                          | see TPR                         |
| Probability of detection          | see TPR                         |
| True negative rate (TNR)          | TN / (TN + FP)                  |
| Specificity                       | see TNR                         |
| Selectivity                       | see TNR                         |
| Positive predictive value (PPV)   | TP / (TP + FP)                  |
| Precision                         | see PPV                         |
| Negative predictive value (NPV)   | TN / (TN + FN)                  |
| False negative rate (FNR)         | FN / (FN + TP)                  |
| Miss rate                         | see FNR                         |
| False positive rate (FPR)         | FP / (FP + TN)                  |
| Fall out                          | see FPR                         |
| False discovery rate (FDR)        | FP / (FP + TP)                  |
| False omission rate (FOR)         | FN / (FN + TN)                  |
| F1 score                          | 2TP / (2TP + FP + FN)           |
| F-score                           | see F1 score                    |
| F-measure                         | see F1 score                    |
| Sørensen-Dice coefficient         | see F1 score                    |
| Dice similarity coefficient (DSC) | see F1 score                    |
|-----------------------------------+---------------------------------|

Hortonworks Community Connection (HCC) is an online collaboration destination for developers, DevOps, customers and partners to get answers to questions, collaborate on technical articles and share code examples from GitHub.  Join the discussion.

Topics:
probability and statistics ,big data ,data science

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}