Repository navigation
FIX: Show scorer accuracy, precision, and recall as percentages - #3882
Open
SERAG AHMED (seragAhmed) wants to merge 2 commits into
Open
SERAG AHMED (seragAhmed) wants to merge 2 commits into
SERAG AHMED (seragAhmed) wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 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
SERAG AHMED (seragAhmed)
force-pushed
the
fix/3859-scorer-metric-percentages
branch
from
November 3, 2026 13:06
cdb698b to
290980c
Compare
Author
|
@microsoft-github-policy-service agree |
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.
This branch has not been deployed
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.
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 as95.0%. The cause is thatformatScorerMetricspecial-cased onlyaccuracy.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_METRICSset that both formatters use. F1 stays on its 0-to-1 scale in both views (0.91→0.9100), andaccuracy_standard_errorstays a raw decimal, since as a percentage it would need a percentage-points label. Missing values keep theUnavailablefallback, andaverage_score_time_secondsis unchanged.Tests and Documentation
ObjectiveScorerDetails.test.tsxrenders 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.9568for F1), null and absent metrics (Unavailable), no evaluation, and the other metrics keeping their units.ScorerRegistry.test.tsxnow expects F1 as0.9100in the comparison table.src/components/Scenarios,src/components/Scorers,src/utilsandFindingEvidenceList(36 suites, 804 tests) pass, as do type-check and lint on the changed files.