Skip to content
DeepForgeby svx
All problems
HardComputer Visioncv-303

Retrieval mAP Lite

Problem

Compute mean average precision over several retrieval queries.

For each ranked list of 0/1 relevance flags compute AP as the mean of precision@k over the relevant positions. Queries with no relevant items contribute 0.0. Return the mean over all queries rounded to 4 decimal places.

Test cases

case 1
in: [[[1,0,1],[0,1,0,1]]]
expected: 0.6667
case 2
in: [[[1,1,0]]]
expected: 1
case 3
in: [[[0,0],[1,0,0]]]
expected: 0.5
Starter codePython
def retrieval_map(relevant_lists):
    # Your code here
    pass

3 test cases · run your code against them in the editor