Title: Precision-Recall values of retrieved document
Tags: precision-recall
Question: I'm learning precison and recall of documents and I'm having trouble understanding this particular question.
The table below shows the relevance of the top 6 results returned by two ranked
retrieval search engines denoted by A and B. '+' indicates relevant documents and '-' indicates non-relelevant documents.
Assuming that the total number of relevant documents in the collection was 4, compute precision-recall values for the two engines for the top 1, 2, 3, 4, 5 and 6 results.
The solution given for search engine A was:
Precision:--100%--|--50%--|--33.3%--|--25%--|--40%--|--50%--|
Recall   :------25%--|--25%--|--25%-----|--25%--|--50%--|--75%--|
The solution for B:
Precision: --|100%--|--100%--|--66.6%--|--50%--|--60%--|--50%--|
Recall: ----|---25%---|--50%----|--50%-----|--50%--|--75%--|--75%--|
I know how to calculate for single documents and that Precsion = TP/(TP+FP) and Recall is TP/(TP+FN). I'm just not sure how some of the values above are calculated.


Here is another answer: Instead of trying to memorize formulas, try to understand the concepts.
&quot;Precision&quot; is: What proportion of the results are correct? Hence, for both A and B, if you take the top result, it is correct. The precision is 100%.
&quot;Recall&quot; is: What proportion of the correct results are present? Hence, for both A and B, if you take the top result, you have one out of four correct values, so the recall is 25%.
Comment for this answer: The 2nd result for A is irrelevant and I'm guessing the precision values till the 4th one were divided by 2,3 and 4 respectively while the recall stayed the same. How were the 5th an 6th precision values gotten? I understand how their recalls were calculated as you've explained.
Comment for this answer: I've gotten how the 4th and 5th values were calculated. 2/5 as it's the second relevant and 3/6 as it's the third relevant.
Comment for this answer: @Gina . . . Good.  Remember the definitions.  This seems like a good example to think about.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:05/09/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<precision-recall>', 'Title': 'Precision-Recall values of retrieved document', 'ViewCount': 168, 'id': 30142532, 'user_AboutMe': None, 'user_AccountId': 5884901.0, 'user_DisplayName': 'Gina', 'user_Reputation': 85.0, 'user_Views': 24.0, 'user_id': 4633221.0}}