Skip to content

Add the UK national calibration step over ledger-backed target references - #729

Open
MaxGhenis wants to merge 3 commits into
mainfrom
uk-national-calibrate
Open

Add the UK national calibration step over ledger-backed target references#729
MaxGhenis wants to merge 3 commits into
mainfrom
uk-national-calibrate

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

Summary

The national calibrate step scoped in #623, stacked on #727 (base branch; the first commit here is tree-identical to its head). Part of #623 and #701 — the post-calibration aggregate-scaler adjudication (2026-08-14 comment) stays open and out of scope: no incumbent scalers are ported.

  • uk_runtime/national_calibration.py: resolves activated references from uk/target_references.json against the pinned chronicle facts; an activated reference that cannot compile aborts the build (the policyengine-uk-data#456 silent-drop class is impossible by construction). Builds the benefit-unit-grain target matrix per the reference declarations and calibrates household weights via microcosm.calibrate.calibrate() (public API only).
  • Activation: dwp.uc.households (caseload, sum of benefit units with universal_credit.amount > 0) and obr.universal_credit_in_cap (expenditure), both period 2025 under the resolver's per-reference resolve-at-or-before semantics. Facts: chronicle#184 (fixture-backed here; live resolution needs the released chronicle bundle carrying Add proximal L1 solver path #184 — stated dependency).
  • Diagnostics: per-target estimate/target/rel-error plus loss/ESS/weight-ratio in the step manifest, following the US build's calibration-diagnostics pattern.
  • Gate: release-blocking activated-vs-entered count check, per the UK gate adjudication: reference registry, spec-armed thresholds, weight-ratio re-baseline (#630) #706 registry pattern (uk/gates.json).
  • Driver: tools/build_uk_national_dataset.py grows an opt-in calibration flag + diagnostics JSON output; the staging seam's behaviour without the flag is unchanged.

No dataset was built; running this on the real staging H5 is a later, gated act. Refs: #707, #727, chronicle#184, policyengine-uk-data#452.

🤖 Generated with Claude Code

MaxGhenis and others added 2 commits August 20, 2026 16:23
…nces

Part of #623 and #701: a named national stage that resolves activated
references against pinned chronicle facts (any unresolvable activated
reference aborts the build), builds the benefit-unit target matrix, and
calibrates household weights through microcosm-calibrate's public front
door. Activates the UC caseload and UC-in-cap expenditure references at
period 2025. Post-calibration aggregate scalers stay out of scope per the
open adjudication on #623.
Rebasing over merged #727 (and #730 beneath it): main's
TestUnevidencedArms now enumerates the closed set of gates that report
evidence_absent when the battery runs unarmed, so the new
uk_calibration_reference_coverage gate joins that set. Also squares the
indentation of the earlier enumeration update in the national-build
terminal-batch test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@juaristi22
juaristi22 force-pushed the uk-national-calibrate branch from e077f5d to 9dcc83b Compare August 20, 2026 14:52
@juaristi22
juaristi22 changed the base branch from uk-uc-contract-refresh to main August 20, 2026 14:52
Adding uk_calibration_reference_coverage to uk/gates.json moves the
three vintage pins (policy sha256, gates-manifest sha256, spec
fingerprint) and the entry-gates mirror in the data contract, plus the
schema-3-style local copies in the data shard's contract tests. The new
entry carries no legacy detail schema and contributes no evidence
digest, so the legacy-name and evidence-id mirrors are unchanged; the
all-passing fixture mirrors the evaluator's activated/resolved/matrix
detail block.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants