Repository navigation
Add a frequency tie-break and per-match frequencies to semsim search - #1484
Draft
kevinschaper wants to merge 1 commit into
Draft
kevinschaper wants to merge 1 commit into
kevinschaper wants to merge 1 commit into
Conversation
`tie_break=frequency` orders entities with equal scores by how frequent the matched phenotypes are in each entity: OMIM patient counts where recorded, else the midpoint of the HPO frequency category, else `default_frequency` (0.5). The tie-break runs inside the ranking query, so the limit keeps the best of a tie group. Frequencies come from a view over the KG's edges, evaluated per query; nothing is computed at startup. Each best match in a ducksim search now carries the matched annotation's recorded frequency, when it has one. Part of #1478. Claude-Session: https://claude.ai/code/session_01RmR3yV2ogn7Rx7bJnXXouU
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/semsim-annotation-ic #1484 +/- ##
============================================================
Coverage ? 85.77%
============================================================
Files ? 134
Lines ? 7911
Branches ? 0
============================================================
Hits ? 6786
Misses ? 1125
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Oct 23, 2026
This branch has not been deployed
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.
Closes #1478. Part of #1474. Based on #1483.
Summary
tie_break(nonedefault, orfrequency) anddefault_frequency(0.5) on search.frequency, entities with equal scores are ordered by how frequent the matched phenotypes are in each entity. For each query term, the harness takes the frequency of the entity annotation that best matches it, and sums those in log space.has_quotient, such as 9 of 12 patients, when present.default_frequency.limitkeeps the best of a tie group, not its first IDs.frequency, the matched annotation's recorded frequency when it has one.Design notes
_freqview overedges, evaluated over only the entities that query touches, so nothing is computed at startup. The other option in semsim API: frequency tie-break for phenotype search #1478 was a normalised column built into the KG. That's still available if Solr or the UI need the numbers elsewhere.Testing
default_frequency, the tie-break applying before the limit, per-match frequencies, KGs without frequency columns, and the API.https://claude.ai/code/session_01RmR3yV2ogn7Rx7bJnXXouU