Skip to content

FIX: Show scorer accuracy, precision, and recall as percentages - #3882

Open
SERAG AHMED (seragAhmed) wants to merge 2 commits into
microsoft:mainfrom
seragAhmed:fix/3859-scorer-metric-percentages
Open

SERAG AHMED (seragAhmed) wants to merge 2 commits into
microsoft:mainfrom
seragAhmed:fix/3859-scorer-metric-percentages

Conversation

@seragAhmed

@seragAhmed SERAG AHMED (seragAhmed) commented Nov 3, 2026 •

Copy link
Copy Markdown

Description

Fixes #3859.

The Attack Result Details objective-scorer card (ObjectiveScorerDetails → ScorerMetricsDetails) showed accuracy as a percentage but precision and recall as raw fractions (0.9500), while the scorer comparison formatter showed them as 95.0%. The cause is that formatScorerMetric special-cased only accuracy.

Following review, accuracy, precision, and recall are now shown as percentages in both views (two decimals in the details view, one in the comparison table), through one PERCENT_METRICS set that both formatters use. F1 stays on its 0-to-1 scale in both views (0.91 → 0.9100), and accuracy_standard_error stays a raw decimal, since as a percentage it would need a percentage-points label. Missing values keep the Unavailable fallback, and average_score_time_seconds is unchanged.

Tests and Documentation

  • New ObjectiveScorerDetails.test.tsx renders the real component with the issue's values (0.94 / 0.91 / 0.95 / 0.88), plus 0, 1, and rounding (0.95678 → 95.68% for the percentage metrics, 0.9568 for F1), null and absent metrics (Unavailable), no evaluation, and the other metrics keeping their units.
  • ScorerRegistry.test.tsx now expects F1 as 0.9100 in the comparison table.
  • Locally on Node 24.19.0: the affected suites plus src/components/Scenarios, src/components/Scorers, src/utils and FindingEvidenceList (36 suites, 804 tests) pass, as do type-check and lint on the changed files.
  • No documentation changes needed; frontend-only change, so JupyText does not apply.

Copilot AI balanced review requested due to automatic review settings November 3, 2026 12:55

Copilot AI 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.

🟢 Approval recommended

No active review issues are recorded for the change to display scorer-detail ratio metrics as percentages.

No open issues 🎉

What changed in this PR

Fixes #3859 by displaying F1, precision, and recall as percentages in scorer details, consistent with accuracy and the comparison view.

Changes:

  • Uses the existing ratio-metric set to format details values as two-decimal percentages.
  • Preserves missing-value fallbacks and non-ratio metric formatting.
  • Adds component regression tests and updates the scenario-page F1 expectation.
File Description
frontend/​src/​utils/​scorerPresentation.ts Formats all recognized ratio metrics as percentages.
frontend/​src/​components/​Scenarios/​ScenarioRunPage.test.tsx Updates the expected F1 display to 94.00%.
frontend/​src/​components/​AttackResults/​ObjectiveScorerDetails.test.tsx Tests percentages, boundaries, rounding, missing evaluations, and unchanged non-ratio units.

Review effort: Balanced

The objective-scorer details card formatted only accuracy as a
percentage, so F1, precision, and recall rendered as raw fractions
(0.9100) while the scorer comparison showed the same values as 91.0%.

Format every metric in RATIO_METRICS as a two-decimal percentage,
matching accuracy. The set is shared with the comparison formatter, so
the two views cannot drift. Missing values keep their fallback, and
non-ratio metrics (standard error, timing) are unchanged.

Fixes microsoft#3859
@seragAhmed
SERAG AHMED (seragAhmed) force-pushed the fix/3859-scorer-metric-percentages branch from cdb698b to 290980c Compare November 3, 2026 13:06
@seragAhmed

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@romanlutz Roman Lutz (romanlutz) self-assigned this Nov 5, 2026
Review feedback: show only accuracy, precision, and recall as percentages.
F1 stays a 0-to-1 score (0.91 -> 0.9100) in the details view and in the
registry comparison, and accuracy_standard_error stays a raw decimal.
@seragAhmed SERAG AHMED (seragAhmed) changed the title FIX: Show scorer F1, precision, and recall as percentages FIX: Show scorer accuracy, precision, and recall as percentages Nov 8, 2026

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scorer detail view displays F1, precision, and recall as fractions

3 participants