Repository navigation
fix: count entities masked under any label in the per-label NER rows - #102
Closed
cristiangirlea wants to merge 3 commits into
Closed
cristiangirlea wants to merge 3 commits into
cristiangirlea wants to merge 3 commits into
Conversation
The Masked column of ner_measure.py counted, in each label's row, only predictions with that label, so it always equalled the overlapping recall. It now counts a gold entity as masked when a predicted span of any label shares a character with it, one gold span per predicted span, as the all-labels row already did. The WNUT-17 table is measured again; its other columns are unchanged.
Owner
Author
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.
Fixes #84.
Draft until one more commit: the invented-sample NER table in
docs/testing.mdstill shows the old per-label Masked cells. That table was published from the model workflow on GitHub's runner (AMD EPYC 7763), and int8 inference on another CPU moves its other columns too: the unchanged script reproduces the same shifts on a Ryzen 9 9950X. So it will be taken from this pull request's ownmodeljob summary, which runsmodel-nerbecausescripts/ner_measure.pyis on the workflow'spaths:, and added as a follow-up commit once its non-Masked columns are checked against the published ones.What
In
scripts/ner_measure.pythe per-label Masked column counted only predictions carrying the entity's own label, so in a label's row it always equalled overlapping recall (PER 0.88 and 0.88 in the invented sample). Masked now means what the all-labels row already measured: a gold entity is masked when a predicted span of any label shares a character with it, one gold span per predicted span. The match runs once per sentence and each masked gold span is attributed to its own label, so the label rows' Masked counts add up exactly to the all-labels row. Exact and overlapping scoring are unchanged.Measured again
WNUT-17, on the same CPU as the published table (Ryzen 9 9950X), measured again after the fix; every non-Masked column and the all-labels rows are identical:
The paragraph after the table now quotes the per-label figures. Its 0.59, 0.78 and "against 0.80" figures didn't move.
Files
scripts/ner_measure.py,tests/python/test_ner_measure.py,docs/testing.md,CHANGELOG.md(Unreleased, Fixed).Tests
2 != 1for the cross-label case before the second fix.Checks
The full command block of
AGENTS.md, run as one command on this head (89459e0, the two fix commits merged withmainat 11ffa30) in a worktree, PHP 8.5:python-tests: Ran 409 tests, OKpy-analysis: All checks passed! and Success: no issues found in 11 source filesphp-tests: 148;php-integration: 192;integration: PASSmcp-tests: 125, OKcomposer-install,php-analysisandphp-psr18-tests(178): oklaravel-tests: 94;symfony-tests: 96;tls-check: 7 + 3The WNUT-17 measurement itself:
quality-fetcher(SHA-256 verified), thenmodel-worker, thenner_measure.pywithNER_DATASET=wnut17.Review
Independent read-only review by codex (another model family) of the first fix commit. It found one blocking defect: each label row ran its own match, so one prediction could mask a gold span in two rows. That is fixed in the second commit, with the cross-label test above. It also confirmed that exact and overlapping are untouched and that the prose matches the table. Security: nothing open.