Repository navigation
Apply one-to-one selection when all match scores are equal - #107
Merged
kPsarakis merged 1 commit intoOct 30, 2026
Merged
Conversation
kPsarakis
force-pushed
the
fix/one-to-one-tied-scores
branch
from
October 30, 2026 11:22
9f4f64d to
a6106b4
Compare
one_to_one_hungarian() and one_to_one_greedy() returned early when the results had fewer than two distinct scores, because the median threshold can't be computed then. The early return also skipped the 1:1 selection itself and ignored an explicit threshold, so tied results (e.g. JaccardDistanceMatcher on columns with identical values) stayed many-to-many and the 1:1 Precision/Recall/F1Score were computed on them. Move the default threshold into _default_threshold(), which returns the single score when all scores are equal, and always run the selection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kPsarakis
force-pushed
the
fix/one-to-one-tied-scores
branch
from
October 30, 2026 11:30
a6106b4 to
99f2d20
Compare
This was referenced Oct 30, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix/105-metric-name-collisions #107 +/- ##
==================================================================
+ Coverage 95.24% 95.27% +0.02%
==================================================================
Files 53 53
Lines 2839 2833 -6
Branches 446 443 -3
==================================================================
- Hits 2704 2699 -5
Misses 83 83
+ Partials 52 51 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Stack: 2 of 3. #106 → this PR → #109 (metric input validation and docs). Based on #106, so the diff shows only this change. Merge #106 first.
Problem
one_to_one_hungarian()andone_to_one_greedy()return early when the results have fewer than two distinct scores, because the median threshold can't be computed then. The early return also skips the 1:1 selection itself, so:JaccardDistanceMatcheron two tables whose columns hold identical values scores all 4 pairs 1.0; "1:1" keeps all 4, andPrecision()reports 0.5 where a 1:1 selection gives 0.0 or 1.0.one_to_one_hungarian(threshold=0.9)on a single 0.2-scored pair still returns that pair.Since these are the default filters behind
Precision,Recall,F1ScoreandPrecisionTopNPercent, those metrics are affected.Change
MatcherResults._default_threshold(). When all scores are equal it returns that score, so nothing is cut; otherwise it uses the same formula as before.one_to_one_greedy()returns early only for empty results.Tests
New
TestOneToOneTiedScoresintests/test_coverage_gaps.py, replacingTestGreedyEarlyReturn:Precisionuses the 1:1 selectionJaccardDistanceMatcher6 of the new tests fail on #106 without this change. Full suite: 318 passed locally.
🤖 Generated with Claude Code