Skip to content

docs: say AUROC measures ranking, not calibration (#491) - #672

Open
MaxonT wants to merge 4 commits into
awslabs:devfrom
MaxonT:contrib/491-auto
Open

MaxonT wants to merge 4 commits into
awslabs:devfrom
MaxonT:contrib/491-auto

Conversation

@MaxonT

@MaxonT MaxonT commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

The Confidence Metrics page described an AUROC score as calibration, but AUROC only measures how well confidence ranks right answers above wrong ones, so this rewords it and points readers to the Brier and ECE metrics for calibration.

Refs #491 (item 1 only)

The Advanced docs call AUROC "well calibrated" / "inversely calibrated", and four other places in two more pages use "calibration" for the same module. AUROC measures ranking: whether right fields get higher confidence than wrong ones. A model whose confidences all sit between 0.90 and 0.99 can score AUROC 1.0 and still be badly calibrated, and the same page offers BrierScoreMetric and ECEMetric, which are the calibration metrics.

Changes (docs only, 3 files, 8 lines added, 6 removed):

  • Advanced/confidence-metrics.md: the AUROC table now reads "Confidence ranks right answers above wrong ones." (0.7 - 1.0) and "Confidence is higher on errors." (< 0.5), and one sentence follows it: "AUROC measures ranking, not calibration. To check whether 0.9 means 90% right, use BrierScoreMetric or ECEMetric."
  • Advanced/rich-value-pattern.md (2 places), Advanced/bbox-map-metrics.md (2 places): "calibration" becomes "confidence quality" / "confidence scoring", as the issue proposes.
  • Advanced/README.md has the same word in the Confidence Metrics bullet; docs: improve documentation indexes and API reference #641 already rewrites that line, so I left it alone to avoid a conflict.

Left for later, not in this PR: items 2 to 5 of #491. Item 4 needs a maintainer decision. The top-level README.md and models/README.md still say "calibration metrics" for the AUROC, Brier and ECE group as a whole, which is accurate because Brier and ECE are calibration metrics; I did not touch them.

What I ran, importing stickler from this checkout (dev at 0a4820f, inspect.getfile pointed at the checkout's src/): AUROCMetric, BrierScoreMetric and ECEMetric on 8 pairs with confidences 0.99/0.98 on right fields and 0.90 on two wrong ones gave AUROC 1.0, Brier 0.203, ECE 0.215. Perfect ranking, poor calibration, which is the claim the new sentence makes. ruff check . passes. I did not build the MkDocs site or run the test suite (the docs are not read by a test I know of; in my environment pytest stopped on 5 collection errors for missing optional dependencies, unrelated to these files). No CHANGELOG.md entry, since no code or behaviour changed.

Signed-off-by: Ym <173550318+MaxonT@users.noreply.github.com>

@vawsgit vawsgit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM!

Checked at 4917fa51 (merge base is dev 0a4820f4, so no rebase is needed). The diff is the 3 docs files only. git diff --stat origin/dev HEAD -- src tests is empty.

The new wording matches the code on dev (src/stickler/structured_object_evaluator/models/confidence/metrics.py):

  • AUROCMetric.compute calls binary_roc_auc(is_match, confidence). That is a ranking measure, so "ranks right answers above wrong ones" is accurate.
  • BrierScoreMetric is the mean of (confidence - outcome)², and ECEMetric bins by confidence and compares confidence with match rate. Both measure calibration, so pointing readers to them is right.
  • AUROCMetric, BrierScoreMetric and ECEMetric are all imported in the page's own example (confidence-metrics.md:126), so the new sentence names classes the reader has already seen.

Measured on dev 0a4820f4 (PYTHONPATH=<dev>/src, inspect.getfile(stickler) pointed at that tree), using the 8 pairs from the PR body (right answers at 0.99/0.98, two wrong at 0.90):

Metric Value
AUROC 1.0
Brier 0.203
ECE 0.214

That is perfect ranking with poor calibration, which is what the new sentence says. When the confidence is higher on the wrong answers, AUROC is 0.0, which matches the new "< 0.5" row.

Other "calibrat" wording. I searched docs/, README.md and src/:

  • Advanced/README.md:19 still says "AUROC-based confidence calibration". #641 (open) rewrites that line to "...correlate with actual accuracy using metrics such as AUROC", so leaving it alone avoids a conflict.
  • The Guides/Best-Practices hits are about calibrating comparator thresholds with SMEs, not about AUROC.
  • Guides/Evaluation/confidence-evaluation.md:63-64 uses "calibration error" for Brier and ECE, which is correct.

Issue keyword. Refs #491 is right. Items 2 to 5 of #491 are still on this head: confidence-metrics.md:115, rich-value-pattern.md:94, rich-value-pattern.md:159 plus the "removed in 0.5.0" messages in src/, and the [0.3, 0.4, 0.5, 0.1] box at rich-value-pattern.md:81,89.

Checks.

  • The full suite passes on the PR tree: 6751 passed, 13 skipped, 1 xfailed. The PR changes no code, so this only confirms the tree is sound.
  • The new AUROC table renders as a 3-row table.
  • No CI checks are reported on this head yet.

Optional, not blocking: docs/structured_model_REFACTORING.md:66 reads "AUROC and other calibration metrics". It sits outside the MkDocs site and outside #491's list, but it makes the same claim this PR corrects. It could get a one-word fix here or in a follow-up for #491.

@sromoam sromoam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MaxonT, this is a clean, well-scoped fix. I checked it at 4917fa51: docs only, merges cleanly with dev (ce0f710b), and the numbers below come from this tree (inspect.getfile(stickler) pointed at its src/) and match dev. vawsgit's review covers the rest, so there's just one change, to wording I proposed in #491.

Must fix

  1. BrierScoreMetric can't tell you whether 0.9 means 90% right (docs/docs/Advanced/confidence-metrics.md:176). That half of the sentence is mine, and it's wrong. Brier is the mean squared error between confidence and outcome (metrics.py:107), so it also rewards confidence that separates right answers from wrong ones, and it can prefer a model whose 0.9 is not 90%. Measured on 10 fields each:

    Fields Brier ECE Fields at 0.9 that are right
    all at 0.9, 9 right 0.090 0.000 9 of 10
    8 right at 0.9, 1 right at 0.7, 1 wrong at 0.1 0.018 0.120 8 of 8

    Brier scores the second set five times better, yet there 0.9 means 100%. ECEMetric's bins (accuracy against mean_confidence) answer the question directly. Suggestion inline.

One heads-up: we're not merging anything outside the 1.1.0 milestone until 1.1.0 lands, so this will wait until after that even once it's ready.


AUROC returns `None` when all predictions match (no negative class) or all fail (no positive class).

AUROC measures ranking, not calibration. To check whether 0.9 means 90% right, use `BrierScoreMetric` or `ECEMetric`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must fix 1: point the calibration check at ECE's bins, and say why Brier alone doesn't answer it.

Suggested change
AUROC measures ranking, not calibration. To check whether 0.9 means 90% right, use `BrierScoreMetric` or `ECEMetric`.
AUROC measures ranking, not calibration. To check whether 0.9 means 90% right, use `ECEMetric` and compare each bin's `accuracy` with its `mean_confidence`. `BrierScoreMetric` also rewards confidence that separates right answers from wrong ones, so a lower Brier score alone does not mean better calibration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the suggested wording reads better. Done in f57b5a8: the calibration sentence now points at ECEMetric and compares each bin's accuracy with its mean_confidence, and it says that BrierScoreMetric also rewards separating right answers from wrong ones, so a lower Brier score alone does not mean better calibration. Docs only, no code touched.

Signed-off-by: Ym <173550318+MaxonT@users.noreply.github.com>

@sromoam sromoam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MaxonT. The calibration sentence now points at ECE's bins and says why Brier alone doesn't answer the question, so this is ready. I checked f57b5a8 merged with dev (9680269). It's docs only, the merge is clean, the full suite gives 7479 passed, 3 skipped, 1 xfailed, and make -C docs check passes. On that tree, ECEMetric's bins carry accuracy and mean_confidence. Ten fields at 0.9 with 9 right give Brier 0.090 and ECE 0.000. 8 right at 0.9, 1 right at 0.7 and 1 wrong at 0.1 give Brier 0.018 and ECE 0.120. So the new sentence holds.

Smaller

  1. Optional: a CHANGELOG line. Readers could have taken an AUROC of 0.7 or more as "well calibrated", so a line under ## [Unreleased], in a new ### Documentation heading, would fit, as on your other docs PR. For example: "Confidence Metrics no longer calls an AUROC of 0.7 or more well calibrated. AUROC measures whether confidence ranks right answers above wrong ones, and the page now points to ECEMetric's bins to check calibration (#491)."
  2. Optional: the two lines you reworded keep their em dashes (bbox-map-metrics.md:283, rich-value-pattern.md:176). A colon, as the See Also list in rich-value-pattern.md uses, would match the rest of our docs. Fine to leave for a follow-up.

@sromoam sromoam added the anytime Non-breaking improvement off the release critical path: merge whenever it's ready label Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

Security Scan Results

ASH Security Scan Report

  • Report generated: 2026-12-04T22:31:21+00:00
  • Time since scan: 3 minutes

Scan Metadata

  • Project: ASH
  • Scan executed: 2026-12-04T22:27:23+00:00
  • ASH version: 3.1.2

Summary

Scanner Results

The table below shows findings by scanner, with status based on severity thresholds and dependencies:

  • Severity levels:
    • Suppressed (S): Findings that have been explicitly suppressed and don't affect scanner status
    • Critical (C): Highest severity findings that require immediate attention
    • High (H): Serious findings that should be addressed soon
    • Medium (M): Moderate risk findings
    • Low (L): Lower risk findings
    • Info (I): Informational findings with minimal risk
  • Duration (Time): Time taken by the scanner to complete its execution
  • Actionable: Number of findings at or above the threshold severity level that require attention
  • Result:
    • PASSED = No findings at or above threshold
    • FAILED = Findings at or above threshold
    • MISSING = Required dependencies not available
    • SKIPPED = Scanner explicitly disabled
    • ERROR = Scanner execution error
  • Threshold: The minimum severity level that will cause a scanner to fail
    • Thresholds: ALL, LOW, MEDIUM, HIGH, CRITICAL
    • Source: Values in parentheses indicate where the threshold is set:
      • global (global_settings section in the ASH_CONFIG used)
      • config (scanner config section in the ASH_CONFIG used)
      • scanner (default configuration in the plugin, if explicitly set)
  • Statistics calculation:
    • All statistics are calculated from the final aggregated SARIF report
    • Suppressed findings are counted separately and do not contribute to actionable findings
    • Scanner status is determined by comparing actionable findings to the threshold
Scanner Suppressed Critical High Medium Low Info Actionable Result Threshold
bandit 0 0 0 0 8000 0 0 PASSED MEDIUM (global)
cdk-nag 0 0 0 0 0 0 0 PASSED MEDIUM (global)
cfn-nag 0 0 0 0 0 0 0 MISSING MEDIUM (global)
checkov 0 0 0 0 0 0 0 PASSED MEDIUM (global)
detect-secrets 0 0 0 0 0 0 0 PASSED MEDIUM (global)
grype 0 0 0 0 0 0 0 MISSING MEDIUM (global)
npm-audit 0 0 0 0 0 0 0 PASSED MEDIUM (global)
opengrep 0 0 0 0 0 0 0 MISSING MEDIUM (global)
semgrep 7 0 0 0 0 0 0 PASSED MEDIUM (global)
syft 0 0 0 0 0 0 0 MISSING MEDIUM (global)

Report generated by Automated Security Helper (ASH) at 2026-12-04T22:31:22+00:00

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

anytime Non-breaking improvement off the release critical path: merge whenever it's ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants