Repository navigation
Respect run score order in TREC evaluation - #905
Open
snygginghani wants to merge 1 commit into
Open
snygginghani wants to merge 1 commit into
snygginghani wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The wrapper assigns an input DataFrame directly to TrecRun. TrecTools' NDCG expects its rows to already be ranked, so changing only row order changes the result. Evaluate also stored run scores as float32 and could turn distinct nearby scores into ties.
Sort by query, descending score and descending document ID, matching the tie-break used by TrecTools MAP. Store incoming Python scores as float64.
On the public TrecTools Robust03 InexpC2 example (100,000 run rows and 128,796 qrel rows), a pandas shuffle with random_state=42 changed NDCG@5 from 0.410148 to 0.028842 and NDCG@10 from 0.380676 to 0.031109 on main. Both input orders now produce 0.410148 / 0.380676, with equal values for all reported fields. Scores 0.50000001 versus 0.5 now give MAP and reciprocal rank of 1.0 in the regression. The exact-tie result remains 0.5.
Both focused tests fail on main and pass with the patch on TrecTools 0.0.50 and pandas 3.0.2. Black, isort, flake8 and git diff --check passed.
Prepared with AI assistance.