# Precision and Recall

I try to understand Precision and Recall:

I have the following definitions: $P= \frac{TP}{TP + FP}$ and $R=\frac{TP}{FP+FN}$

This are the definitions for TP etc.:

True Positive (TP): when similar points are assigned to the same communities

True Negative (TN): when dissimilar points are assigned to different communities

False Negative (FN): when similar points are assigned to different communities

False Positive (FP): when dissimilar points are assigned to the same communities

There is an example I don't understand: I have two Clusters. The first one has 5 crosses and 1 circle. The second one includes 6 circles and 2 crosses.

1: [cross, cross, cross, cross, cross, circle]

2: [cross, cross, circle, circle, circle, circle, circle, circle]


Now I have this calculation I don't understand:

$TP = \binom{5}{2} + \binom{6}{2} + 1 = 26$

$FP = (5*1) + (6*2) = 17$

$FN = (5*2) + (6*1) = 16$

$TN = (6*5) + (2*1) = 32$

I think I can understand the last three. But the first one is a miracle for me. Can anyone explain me how to calculate TP?

Thank you so much!

The $5 \choose 2$ is the number of pairs of crosses in cluster 1, the $6\choose 2$ is the number of pairs of circles in cluster 2, $1={2 \choose 2}$ is the number of pairs of crosses in cluster 2, and there are ${1 \choose 2}=0$ pairs of circles in cluster 1
• Thank yo uvery much. Just one other question: If there would be three clusters and in this third one there would be no cross, how would I compute "FN" ? $FN= (5*2*0) + \dots$ or would I skip the zero. Thanks. – mathNewbie Jan 6 '15 at 20:37