Skip to content

Instantly share code, notes, and snippets.

View Zendelo's full-sized avatar

Oleg Zendel Zendelo

View GitHub Profile
@Zendelo
Zendelo / calc_ndcg.py
Last active April 28, 2022 07:00
Script to calculate nDCG scores between a TREC format run file and a Qrels file
import argparse
import pandas as pd
import numpy as np
TREC_RES_COLUMNS = ['qid', 'iteration', 'docNo', 'rank', 'docScore', 'method']
TREC_QREL_COLUMNS = ['qid', 'iteration', 'docNo', 'rel']
parser = argparse.ArgumentParser(description='Calculates NDCG@k')
parser.add_argument('qrels_file', type=str, help='path to a qrels file')