Commit 69913b98 authored by xstefan3's avatar xstefan3
Browse files

evaluate_run @ evaluate.py: support for ranks starting at zero

parent 394a85c8
Pipeline #62916 canceled with stage
......@@ -79,11 +79,15 @@ def evaluate_run(filename, subset):
'received %d-tuples: %s' % (n, first_line)
)
parsed_result = dict()
rank_offset = 0
for line in lines:
topic_id, result_id, *_, rank, __, ___ = line
# support indexing of ranks starting from 0
if int(rank) == 0:
rank_offset = 1
if topic_id not in parsed_result:
parsed_result[topic_id] = dict()
parsed_result[topic_id][result_id] = 1.0 / int(rank)
parsed_result[topic_id][result_id] = 1.0 / (int(rank) + rank_offset)
ndcg = get_ndcg(parsed_result, task, subset)
print('%.3f' % ndcg)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment