Skip to content

Commit dc57eb7

Browse files
authored
Merge pull request #531 from PolicyEngine/census-block-calibration
Add census-block-first calibration pipeline (from PR #516)
2 parents c2247c2 + 9bcdc0f commit dc57eb7

28 files changed

Lines changed: 3526 additions & 5375 deletions

changelog_entry.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
- bump: minor
2+
changes:
3+
added:
4+
- Census-block-first calibration pipeline (calibration/ package) ported from PR #516
5+
- Clone-and-assign module for population-weighted census block sampling
6+
- Unified matrix builder with clone-by-clone simulation, COO caching, and target_overview-based querying
7+
- Unified calibration CLI with L0 optimization and seeded takeup re-randomization
8+
- 28 new tests for the calibration pipeline
9+
- Integration test for build_matrix geographic masking (national/state/CD)
10+
- Tests for drop_target_groups utility
11+
- voluntary_filing.yaml takeup rate parameter
12+
changed:
13+
- Rewrote local_area_calibration_setup.ipynb for clone-based pipeline
14+
- Renamed _get_geo_level to get_geo_level (now cross-module public API)
15+
fixed:
16+
- Fix Jupyter import error in unified_calibration.py (OutStream.reconfigure moved to main)
17+
- Fix modal_app/remote_calibration_runner.py referencing deleted fit_calibration_weights.py
18+
- Fix _coo_parts stale state bug on build_matrix re-call after failure
19+
- Remove hardcoded voluntary_filing rate in favor of YAML parameter
20+
removed:
21+
- SparseMatrixBuilder, MatrixTracer, and fit_calibration_weights (replaced by unified pipeline)
22+
- 8 old SparseMatrixBuilder-dependent tests (replaced by new test_calibration suite)

docs/calibration_matrix.ipynb

Lines changed: 214 additions & 1222 deletions
Large diffs are not rendered by default.

docs/hierarchical_uprating.ipynb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,16 @@
5151
"import pandas as pd\n",
5252
"\n",
5353
"from policyengine_us_data.storage import STORAGE_FOLDER\n",
54-
"from policyengine_us_data.datasets.cps.local_area_calibration.sparse_matrix_builder import (\n",
55-
" SparseMatrixBuilder,\n",
54+
"from policyengine_us_data.calibration.unified_matrix_builder import (\n",
55+
" UnifiedMatrixBuilder,\n",
5656
")\n",
5757
"from policyengine_us_data.datasets.cps.local_area_calibration.calibration_utils import (\n",
58-
" get_all_cds_from_database,\n",
5958
" STATE_CODES,\n",
6059
")\n",
6160
"\n",
6261
"db_path = STORAGE_FOLDER / \"calibration\" / \"policy_data.db\"\n",
6362
"db_uri = f\"sqlite:///{db_path}\"\n",
64-
"cds = get_all_cds_from_database(db_uri)\n",
65-
"builder = SparseMatrixBuilder(\n",
66-
" db_uri, time_period=2024, cds_to_calibrate=cds\n",
67-
")"
63+
"builder = UnifiedMatrixBuilder(db_uri, time_period=2024)"
6864
]
6965
},
7066
{

0 commit comments

Comments
 (0)