Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RelevanceEvaluator breaks when evaluating on multiple runs #38

Open
seanmacavaney opened this issue Sep 5, 2022 · 0 comments
Open

RelevanceEvaluator breaks when evaluating on multiple runs #38

seanmacavaney opened this issue Sep 5, 2022 · 0 comments

Comments

@seanmacavaney
Copy link
Contributor

As identified by @grodino in terrierteam/ir_measures#42

In short, when a measure with multiple cutoffs are provided to RelevanceEvaluator, only one is returned on subsequent invocations.

>>> import pytrec_eval
>>> qrel = {
>>>   '0': {'D0': 0, 'D1': 1, 'D2': 1, 'D3': 1, 'D4': 0},
>>>   '1': {'D0': 1, 'D3': 2, 'D5': 2}
>>> }
>>> run = {
>>>   '0': {'D0': 0.8, 'D2': 0.7, 'D1': 0.3, 'D3': 0.4, 'D4': 0.1},
>>>   '1': {'D1': 0.8, 'D3': 0.7, 'D4': 0.3, 'D2': 0.4, 'D10': 8.}
>>> }
>>> evaluator = pytrec_eval.RelevanceEvaluator(qrel, {'map', 'ndcg_cut.10,100,2'})
>>> print(evaluator.evaluate(run))
{'0': {'map': 0.6388888888888888, 'ndcg_cut_2': 0.38685280723454163, 'ndcg_cut_10': 0.7328286204777911, 'ndcg_cut_100': 0.7328286204777911}, '1': {'map': 0.1111111111111111, 'ndcg_cut_2': 0.0, 'ndcg_cut_10': 0.26582598262939583, 'ndcg_cut_100': 0.26582598262939583}}
>>> print(evaluator.evaluate(run))
{'0': {'map': 0.6388888888888888, 'ndcg_cut_10': 0.7328286204777911}, '1': {'map': 0.1111111111111111, 'ndcg_cut_10': 0.26582598262939583}}
# ^ second invocation is missing ndcg_cut_2, ndcg_cut_100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant