Definition (classification context)

For classification tasks, the terms true positivestrue negativesfalse positives, and false negatives (see also Type I and type II errors) compare the results of the classifier under test with trusted external judgments. The terms positive and negative refer to the classifier's prediction (sometimes known as the observation), and the terms true and false refer to whether that prediction corresponds to the external judgment (sometimes known as the expectation). This is illustrated by the table below:

actual class
predicted class
(true positive)
Correct result
(false positive)
Unexpected result
(false negative)
Missing result
(true negative)
Correct absence of result

Precision and recall are then defined as:[4]

\text{Precision}=\frac{tp}{tp+fp} \,   [通俗理解:预测出来100个正例,事实只有30个,precesion就是0.3]
\text{Recall}=\frac{tp}{tp+fn} \,      [通俗理解:总共200个正例,事实只有40个,recall就是0.2]

Recall in this context is also referred to as the True Positive Rate or Sensitivity, and precision is also referred to as Positive predictive value (PPV); other related measures used in classification include True Negative Rate and Accuracy:.[4] True Negative Rate is also called Specificity.

\text{True negative rate}=\frac{tn}{tn+fp} \,
\text{Accuracy}=\frac{tp+tn}{tp+tn+fp+fn} \,

A measure that combines precision and recall is the harmonic mean of precision and recall, the traditional F-measure or balanced F-score:

F = 2 \cdot \frac{\mathrm{precision} \cdot \mathrm{recall}}{ \mathrm{precision} + \mathrm{recall}}
Compressed labeling on distilled labelsets for multi-label learning公式85和86,这是对应multi-label的precision和 recall。(例如第i个样本的实际标记是 1 0 0;预测标记是1 1 0;该样本对应的值是1/2,与单label的意义很好对应物理意义很好理解)