Omit population-ranked variables from illustrative household results - #256
Open
vahid-ahmadi wants to merge 1 commit into
Open
Omit population-ranked variables from illustrative household results#256vahid-ahmadi wants to merge 1 commit into
vahid-ahmadi wants to merge 1 commit into
Conversation
An illustrative household simulation contains exactly one household, so any variable defined by the household's position within the simulated population ranks it against itself. household_income_decile and household_wealth_decile return 10, and in_relative_poverty_bhc and in_relative_poverty_ahc return 0, for every household regardless of income. The model had these on every household result as default output columns and could report them as national positions. Name them in POPULATION_RANKED_HOUSEHOLD_VARIABLES, remove them from household results, and report each name with the reason and the society-wide tool to use instead under omitted_population_ranked_variables. Absolute poverty uses a fixed threshold and is unaffected, as are society-wide tools. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W5Zsotd2SND15F9efcePoP
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Beta preview is ready.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #256 +/- ##
==========================================
+ Coverage 68.00% 68.07% +0.06%
==========================================
Files 109 109
Lines 6827 6848 +21
Branches 1390 1398 +8
==========================================
+ Hits 4643 4662 +19
- Misses 1771 1772 +1
- Partials 413 414 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
64 tasks
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.
Part of #250 (§3, the
household_income_decileregression item).The bug
#250 asks for a regression test documenting that
household_income_decileis ranked against the current simulation population, and noteshousehold_income_decile: 10for a £6,000 single earner "looks wrong". It is worse than implausible — it is constant. An illustrative household simulation contains exactly one household, so any variable defined by that household's position within the simulated population ranks it against itself:(measured on
policyengine-uk2.89.2, year 2026)These are default output columns, so the model sees them on every household simulation and can report a synthetic household as top-decile and not in relative poverty whatever its income. Relative poverty is the same defect: a single household is its own median, so the flag can never be 1.
The change
POPULATION_RANKED_HOUSEHOLD_VARIABLESinbackend/engine/constants.pynames the four affected variables with the reason and the society-wide tool to use instead.calculate_householdremoves them from baseline and reform result blocks and reports them underomitted_population_ranked_variables, so the model is told the value is unavailable and why rather than being left to infer.docs/engineering/skills/uk-chat-runtime.mdrecords the boundary, per the AGENTS.md rule that canonical docs move first.Removal is deterministic in the engine. The prompt rule reinforces it but is not what enforces it.
Absolute poverty (
in_poverty_bhc,in_poverty_ahc) uses a fixed threshold and stays available. Society-wide tools are untouched: they simulate the full weighted population, where these variables carry their intended meaning.Scope judgement for review
#250 names only
household_income_decile. I extended it to the wealth decile and both relative poverty flags because they are the same defect with the same user-visible consequence. Happy to narrow to the decile alone if you would rather keep the beta diff minimal.Verification
backend/tests/test_household_population_ranked_variables.py— 6 tests, including one reading the engine directly, before removal, to pin the constant-across-incomes behaviour.tool_contracteval casehousehold_omits_population_ranked_variablesandanswercaseanswer_household_decile_not_national(the answer must decline a decile rather than infer one).make eval-ai-offline: 118 passed, 0 failed (116 before this branch).test_modal_app.pypreview-cleanup failures reproduce on a clean checkout ofmainand are unrelated to this change.🤖 Generated with Claude Code
https://claude.ai/code/session_01W5Zsotd2SND15F9efcePoP