Repository navigation
Conversation
The engine contract now checks prepare_brma_spread end to end: the engine's LHA categories select the right census cells, the household distribution averages normalized unit cells (not pooled counts), the rate order matches lha_rate_keys, a single-BRMA region pads with an unselectable zero column, and the lineage uniforms match stable_identity_uniforms. The UK gates manifest lists the new local BRMA enum-domain gate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The data shard's gate-battery mirrors still held the previous digests and lacked uk_local_brma_enum_domain, so the lockstep test and the signed end-to-end report fixture failed. Direct assign_clone_brmas cases pin the boundary rule (a quantile on a cumulative boundary takes the next BRMA; zero-probability columns are never chosen), which the production comparison's <= to < mutant previously survived. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The terminal uk_local_brma_enum_domain entry passes in this unscoped probe, where the enum_domain binding is stubbed, so the battery now passes 21 gates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 14, 2026
Draft
Closed
Collaborator
|
@MaxGhenis this PR overlaps with #1305, now open as a draft. Both write household
Which do you want for this PR?
The wider questions on the direction are on PolicyEngine/policyengine-uk-data#521 (13 and 16 October). 🤖 Generated with Claude Code |
Collaborator
|
Closing: #1305 merged today (a90eec3) and supersedes this PR on the local line in Great Britain.
The questions on the direction are on PolicyEngine/policyengine-uk-data#521. The comment above asked whether to close this PR or keep it for Northern Ireland. 🤖 Generated with Claude Code |
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.
Draft. The code is ported to current main and tested. An independent review at this head is running. Calibrated outcomes have not been measured (see "What this does not show").
Problem
frs_brmagives each UK spine household one Broad Rental Market Area (BRMA) draw. The local candidate clones every spine household K = 15 times, and today every clone keeps that one BRMA.In policyengine-uk-data the same single draw is noisy. With weights held fixed, one re-draw has an SD of £177m for UK Universal Credit and 53k for people in AHC poverty, and a few heavily weighted private renters carry most of it.
Change
The local pool spreads each household's BRMA across its K clones.
uk.full.brma_table, before expansion, engine. For each normalized spine household it computes:LHA_category, asfrs_brmadraws;uncapped_BRMA_LHA_rate, falling back toBRMA_LHA_rate;u_hkeyed by the household's pre-geographic lineage, with seed 0 and saltbrma:clone_spread.uk.full.brma, after expansion, engine-free,Owned("household", "brma", "string", rewrite=True). Clone c takes the BRMA at quantile(u_h + c/K) mod 1in that order. It adds no rows and changes no weights or other columns.uk_local_brma_enum_domain, a terminal release-blocking gate. It rechecks the rewritten candidate against the engine'sbrmaenum. The assembled spine check stays as it is.household_lineage_keysfactors out the geography identity kernel's key loop, including main's CGT residential-split lineage. It is used both before and after expansion. The geographic keys are byte-identical to main's: a golden test holds 78 keys generated by main's own kernel.The spine
frs_brmastage,uk_spine.json,source_stages.jsonand the coverage manifest are unchanged. The national line keeps the spine draws.Invariants (tested)
household_id = pre_id + c * id_multiplierin every expansion path.brmachanges, and every downstream reader of householdbrmadepends onuk.full.brma.Mutation checks killed:
<=→<, in both the helper and the production assignment;u_h;+ c/K;Verification
ruff checkandruff format --checkpass, and so doestools/ci_test_plan.py verify.uk/gates.jsonwith the live producer, and are mirrored in the data shard's lockstep fixtures.What this does not show
Clone weights are still calibrated independently, and
microcosm-calibratehas no weight-tie feature. In uk-data, calibrating split records independently shifted outcomes; grouped calibration fixed that (policyengine-uk-data#579). The variance gain here is shown at fixed weights only. Solved outcomes need a measured local build, and a per-household clone weight tie is the natural follow-up.Companion: PolicyEngine/policyengine-uk-data#579, which splits private renters into k records with grouped calibration.
🤖 Generated with Claude Code