From 83ab446aa46d10e302a8546ebe6432c6aacf4aa0 Mon Sep 17 00:00:00 2001 From: mrjleo Date: Sun, 15 Dec 2024 13:56:50 +0100 Subject: [PATCH] change order of merge in FFScore to maintain sorted rankings --- src/fast_forward/util/pyterrier.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fast_forward/util/pyterrier.py b/src/fast_forward/util/pyterrier.py index e4365da..e468e41 100644 --- a/src/fast_forward/util/pyterrier.py +++ b/src/fast_forward/util/pyterrier.py @@ -40,10 +40,10 @@ def transform(self, inp: "pd.DataFrame") -> "pd.DataFrame": ) )._df.rename(columns={"q_id": "qid", "id": "docno"}) - result = inp[["qid", "docno", "score"]].merge( - ff_scores[["qid", "docno", "score", "query"]], + result = ff_scores[["qid", "docno", "score", "query"]].merge( + inp[["qid", "docno", "score"]], on=["qid", "docno"], - suffixes=("_0", None), + suffixes=(None, "_0"), ) return pt.model.add_ranks(result, single_query=False)