Repository navigation
fix(292): format the budget key as a number in Bulk_Confidence_AUROC - #396
Conversation
ErrorCaptureAtBudgetMetric keys budgets with strings such as "0.10" so the dict round-trips through JSONL, and cell 11 of the notebook applied the % format code to those strings, so it raised ValueError: Unknown format code '%' for object of type 'str'. Convert the key with float() before formatting, as the confidence metrics docs already do. Store the outputs of a full run, so a reader sees the real numbers.
sromoam
left a comment
There was a problem hiding this comment.
Thanks @Thanatos9404, this fixes #292. The budget keys are the f"{budget:.2f}" strings from _budget_key, so float(budget) parses them. I re-ran the notebook's code cells against this branch and against current dev, and both reproduce the stored outputs exactly. Approving.
Optional polish, for this PR or later, whichever you prefer:
- Sections 4 and 6 call the generator "well-calibrated", but the stored ECE is 0.2257. It discriminates well (AUROC 0.987) without being calibrated, so "informative confidence" would be more accurate.
- In the ECE table the last bin is closed (
[0.9, 1.0]), becauseECEMetricputs 1.0 there. The data columns also sit one space left of the headers. bins=10 binsshould readbins=10.
Security Scan ResultsASH Security Scan Report
Scan Metadata
SummaryScanner ResultsThe table below shows findings by scanner, with status based on severity thresholds and dependencies:
Top 2 HotspotsFiles with the highest number of security findings:
Detailed FindingsShow 4 actionable findingsFinding 1: SECRET-HEX-HIGH-ENTROPY-STRING
Description: Code Snippet: Finding 2: B108
Description: Code Snippet: Finding 3: B307
Description: Code Snippet: Finding 4: B307
Description: Code Snippet: Report generated by Automated Security Helper (ASH) at 2026-10-19T16:02:51+00:00 |
Pull Request
Issue Reference
Fixes #292
Description of Changes
Cell 11 of
examples/notebooks/Bulk_Confidence_AUROC.ipynbformatted the string keys ofecab['budgets']with%, which raisesValueError: Unknown format code '%' for object of type 'str'. It now converts each key withfloat()first, as the confidence metrics docs already do. The notebook also stores the outputs of a full run.Changes Made
{budget:<12.0%}becomes{float(budget):<12.0%}. This is the only source change.Why These Changes Are Needed
ErrorCaptureAtBudgetMetrickeysbudgetswith strings on purpose, so the dict round-trips through JSONL; the library stays as it is. The table now reads:Testing
examples/run_examples.pyis not ondev(#291 was closed), so the runner from that branch (ff04e21) was used without committing it:uv run --with nbclient --with nbformat --with ipykernel python examples/run_examples.py --only Bulk_Confidencefails at cell 11 ondevand passes on this branch. The stored outputs come fromjupyter nbconvert --to notebook --execute; repeat runs give identical output (the cells seedrandomwith 42), withsticklerimported from the checkout'ssrc/.Reviewers
@sromoam
Checklist
CHANGELOG.mdentry added under[Unreleased], or not needed becausenothing user-visible changed (see RELEASING.md): example notebook only, nothing in the published package changes
Additional Notes
Running the notebooks in CI is #118, so this PR adds no runner.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.