All problems
Retrieval Recall at K
Problem
Recall at k is the number of relevant documents found in the top k divided by the total number of relevant documents; return 0.0 when there are none.
Given the ranked ids, the relevant set, and k, return recall at k.
Hint
Divide by the number of relevant documents, not by k.
Test cases
case 1
in: [["a","b","c"],["a","c"],2]
expected: 0.5
case 2
in: [["x"],["y"],1]
expected: 0
case 3
in: [["a","b"],["a","b"],5]
expected: 1
Starter codePython
def retrieval_recall_at_k(retrieved, relevant, k):
# Your code here
pass3 test cases · run your code against them in the editor