8000 fix(ask-plan): count invalid plans as zero in macro-F1 by CalebPiusC · Pull Request #3001 · xerj-org/xerj · GitHub
[go: up one dir, main page]

Skip to content

fix(ask-plan): count invalid plans as zero in macro-F1 - #3001

Open
CalebPiusC wants to merge 1 commit into
xerj-org:mainfrom
CalebPiusC:fix/ask-plan-all-pair-f1
Open

CalebPiusC wants to merge 1 commit into
xerj-org:mainfrom
CalebPiusC:fix/ask-plan-all-pair-f1

Conversation

@CalebPiusC
Copy link
Copy Markdown

Refs #2075 (item 16).

What

cmd_ask in benchmarks/ask-plan/scripts/ask_arm.py left score as
None for invalid plans and then averaged only the scored pairs, so
invalid plans were dropped from macro-F1. One perfect plan plus one
invalid plan reported 1.0 instead of 0.5.

Change

Average over all pairs and treat None as 0.0 (2 lines in ask_arm.py).
Adds test_ask_arm.py, a stdlib unittest with the engine mocked.

Before / after

Before the fix:
test_invalid_plan_counts_as_zero ... FAIL
AssertionError: 1.0 != 0.5
After the fix:
Ran 2 tests ... OK

Verified / Assumed / Not-run

Verified (Windows, Python 3.14.5, run locally):

  • the unittest above, failing before and passing after the fix
  • verify_pairs.py: 230 pairs pass
  • derive_pairs.py --check: byte-identical, 230 pairs
  • py_compile and git diff --check: clean
    (the two fixture scripts needed PYTHONUTF8=1 on Windows because they
    open data files without an encoding; I did not change that here)

Assumed:

  • the mocked search_ids/ask_once behaviour matches the live engine

Not-run:

  • Cargo tests, fmt, Clippy, ES-YAML conformance
  • any live engine, benchmark or model run
  • hosted CI

AI assistance: I used an AI assistant (Claude) to help write the test
and review the change; I ran all checks myself.

No workflow, results or README changes.

cmd_ask left score as None for plans that were invalid (HTTP 400 on execution or an unusable response) and then averaged only the scored pairs. A run with one perfect plan and one invalid plan reported macro_f1 1.0 instead of 0.5, so invalid plans made the metric look better instead of worse.

Average over all pairs and treat None as 0.0. Adds a stdlib unittest that fails before this change (1.0 != 0.5) and passes after it.

Refs xerj-org#2075 (item 16).
@cla-bot
cla-bot Bot commented Nov 6, 2026
Copy link
Copy Markdown

Thanks for this contribution — we'd like to merge it.

Before we can, we need a signed Contributor License Agreement from: @CalebPiusC

It is a one-time thing per contributor, not per pull request. Read CLA.md, then open a small pull request adding your GitHub username to .contributors — that pull request is your signature, since it is made from your own account.

Once it is merged, comment @cla-bot check here and this check will go green. If you believe you are already covered, comment @cla-bot check and it will re-verify.

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.

1 participant

0