Repository navigation
docs: fix the filter that silences the auroc_confidence_metric warning #504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pcbeingused33
wants to merge
16
commits into
awslabs:dev
Choose a base branch
from
pcbeingused33:c0792-docs-warning-filter
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e21fa49
docs: fix the filter that silences the auroc_confidence_metric warning
pcbeingused33 81e87cf
docs: address review on the AUROC warning filter
pcbeingused33 5687cf6
Merge remote-tracking branch 'origin/dev' into c0792-docs-warning-filter
pcbeingused33 c30eead
docs: refine warning filters per follow-up review
pcbeingused33 de4f441
docs: clarify reference to AUROC Python filter
pcbeingused33 91b271e
chore: merge dev to resolve changelog conflict
pcbeingused33 66e96ff
Merge origin/dev into c0792-docs-warning-filter
pcbeingused33 d1cedc8
chore: merge dev to resolve changelog and workflow README conflicts
pcbeingused33 38a1eb0
chore: merge dev and resolve changelog conflict
pcbeingused33 89849a4
Merge upstream dev into c0792-docs-warning-filter
pcbeingused33 2e81a63
chore: merge dev into c0792-docs-warning-filter
pcbeingused33 faf35ae
docs: move warning filter changelog entry to Unreleased
pcbeingused33 8f404e6
docs: name the fixture scope for the confidence warning filter
pcbeingused33 663b17f
Merge dev after the 1.1.0 release
sromoam e05401b
docs(changelog): move the entry under [Unreleased] after the 1.1.0 re…
sromoam 6e523ca
chore: merge dev and resolve CHANGELOG.md conflict
pcbeingused33 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| """The warning filters documented in confidence-evaluation.md must silence the warnings.""" | ||
|
|
||
| import warnings | ||
|
|
||
| import pytest | ||
|
|
||
| from stickler import StructuredModel | ||
| from stickler.utils import deprecation | ||
|
|
||
|
|
||
| class _Doc(StructuredModel): | ||
| a: str = "x" | ||
|
|
||
|
|
||
| @pytest.fixture(autouse=True) | ||
| def _fresh_sentinels(monkeypatch): | ||
| monkeypatch.setattr(deprecation, "_warned", set()) | ||
|
|
||
|
|
||
| def _recorded(*filters): | ||
| with warnings.catch_warnings(record=True) as caught: | ||
| warnings.simplefilter("always") | ||
| for kwargs in filters: | ||
| warnings.filterwarnings("ignore", **kwargs) | ||
| _Doc().compare_with(_Doc(), add_confidence_metrics=True) | ||
| return caught | ||
|
|
||
|
|
||
| # Keep these filters aligned with docs/docs/Guides/Evaluation/ | ||
| # confidence-evaluation.md, "Silencing the legacy AUROC deprecation warning". | ||
| AUROC = { | ||
| "message": "The 'auroc_confidence_metric' result key is deprecated", | ||
| "category": DeprecationWarning, | ||
| } | ||
| SINGLE_DOC = { | ||
| "message": "Single-document confidence metrics are a quick sanity check", | ||
| "category": UserWarning, | ||
| } | ||
|
|
||
|
|
||
| def test_without_filters_both_warnings_are_emitted(): | ||
| messages = [str(w.message) for w in _recorded()] | ||
| for warning_filter in (AUROC, SINGLE_DOC): | ||
| assert any(m.startswith(warning_filter["message"]) for m in messages) | ||
|
|
||
|
|
||
| def test_documented_filters_silence_both_warnings(): | ||
| messages = [str(w.message) for w in _recorded(AUROC, SINGLE_DOC)] | ||
| for warning_filter in (AUROC, SINGLE_DOC): | ||
| assert not any(m.startswith(warning_filter["message"]) for m in messages) | ||
|
|
||
|
|
||
| def test_auroc_filter_leaves_the_user_warning(): | ||
| messages = [str(w.message) for w in _recorded(AUROC)] | ||
| assert not any(m.startswith(AUROC["message"]) for m in messages) | ||
| assert any(m.startswith(SINGLE_DOC["message"]) for m in messages) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested wording, so readers don't reach for a session-scoped fixture: