I agree that the terms are very non-intuitive and hard to correspond to their formulas. Here are some diagrams with the mnemonic tricks that I have developed, and now I have them all solidly memorized.
Classification matrix
First, here are the mnemonics summarized in two common variations of the classification matrix (also called confusion matrix). My mnemonics work for either variation, so just focus on the variation of the matrix with which you are more familiar.
Note:
- TP = true positives
- TN = true negatives
- FP = false positives
- FN = false negatives
Short version of mnemonics
Here is the short form of my mnemonics; the details below explain the logic underlying them, which should help in memorizing what they mean:
- Accuracy: correct predictions divided by all predictions: TP+TN/(TP+FP+FP+FN)
- Precision and Recall: focus on true positives
- PREcision is TP divided by PREdicted positive: TP/(TP+FP)
- REcAll is TP divided by REAl positive: TP/(TP+FN)
- Sensitivity and Specificity: focus on correct predictions
- SNIP (SeNsitivity Is Positive): TP/(TP+FN)
- SPIN (SPecificity Is Negative): TN/(TN+FP)
Detailed explanation of logic underlying the mnemonics, corresponding to their intrinsic meaning
Accuracy: overall results
Accuracy is actually quite intuitive and usually presents no difficulty in memorization. It is simply the correct (true) predictions divided by all predictions, whether true or false.
$$
Accuracy = \frac{correct\:predictions}{all\:predictions} = \frac{TP + TN}{TP + TN + FP + FN}
$$
Precision and Recall: focus on true positives
The essence of precision and recall is that they both consider the proportion of true positive results; that is, they are two different ways of measuring how many times the model correctly guessed the class of interest (that is, the positive class). So, TP is always the numerator. The difference between them is in the denominator: whereas precision considers all the values that were predicted to be positive (whether correctly or not), recall considers all the values that actually are positive (whether correctly predicted or not).
Precision is the proportion of positive predictions that were correct:
$$
Precision = \frac{true\:positive}{\pmb P\pmb R\pmb E dicted\:positive} = \frac{TP}{TP + FP}
$$
Recall is the proportion of real or actual positives that were predicted correctly:
$$
Recall = \frac{true\:positive}{\pmb R\pmb E\pmb A l\:positive} = \frac{TP}{TP + FN}
$$
To differentiate them, you can remember:
- PREcision is TP divided by PREdicted positive
- REcAll is TP divided by REAl positive
Sensitivity and Specificity: focus on correct predictions
The essence of sensitivity and specificity is that they both focus on the proportion of correct predictions. So, the numerator is always a measure of true predictions and the denominator is always all the total of corresponding predictions of that class. Whereas sensitivity measures the proportion of correctly predicted positives out of all actual positive values, specificity measures the proportion of correctly predicted negatives out of all actual negative values.
Sensitivity is the proportion of actual positives that were correctly predicted:
$$
Sensitivity = \frac{true\:\pmb Positive}{real\:\pmb Positive} = \frac{TP}{TP + FN}
$$
(Note that the although the formulas for Recall and Sensitivity are mathematically identical, when recall is paired with precision and sensitivity is paired with specificity, the interpretations and applications of the two measures are rather different.)
Specificity is the proportion of actual negatives that were correctly predicted:
$$
Specificity = \frac{true\:\pmb Negative}{real\:\pmb Negative} = \frac{TN}{TN + FP}
$$
To remember which is which, remember "snip and spin", but note that the letters P and N are swapped (that is, they spin around and the ends of the long names are snipped):
- SNIP (SeNsitivity Is Positive)
- SPIN (SPecificity Is Negative)