budget.households is the sum of squared household weights
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 20/100
Línea de trabajo
Start in simulation_output_budget.build_budgetary_impact and inspect how _sum_output_variable handles the household MicroDataFrame and its household_weight column. The existing test test_builder_budgetary_impact_uses_materialized_columns_and_uk_state_tax_zero uses plain DataFrames; add coverage with a real MicroDataFrame and verify the household count is 3 for weights [1, 2]. An open linked pull request (#767) is already addressing this issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
The economy comparison's budget.households is the sum of squared household weights, not the household count. It is about 10⁴ times too high on every run, national and state:
Run (/us/economy/{reform}/over/2) |
budget.households |
Actual households |
|---|---|---|
region=state/ny, 2026 |
135,597,233,840 | ~7.5 million |
region=state/ca, 2026 |
197,620,236,261 | ~13.5 million |
region=state/va, 2027 |
44,192,009,994 | ~3.3 million |
Cause
simulation_output_budget.build_budgetary_impact sets households=_sum_output_variable(baseline, "household_weight", entity="household").
_sum_output_variable returns float(data[variable].sum()). Here data is the household MicroDataFrame, which policyengine weights by household_weight. So data["household_weight"] is a weighted MicroSeries, and its .sum() is Σ w × w.
Weights [1, 2] give 5.0 instead of 3.0. The existing test (test_builder_budgetary_impact_uses_materialized_columns_and_uk_state_tax_zero) uses plain pd.DataFrames, so it never caught this.
This came in with 36d3be0 ("adapt simulation worker to PolicyEngine v4 outputs").
The other budget fields are correct. They are meant to be weighted sums.
Impact
Clients divide by this field. For example, policyengine-app-v2 computes the headline average change per household as -budget.budgetary_impact / budget.households. That number is therefore about 10⁴ times too small on every report.
Fix
Count entities with a plain sum of their weight column, and test it on a real MicroDataFrame.
- Lenguaje dominante
- Python
- Estrellas
- 1
- Forks
- 1
- Merge medio
- 1 d 4 h
- PR fusionados (30 d)
- 27
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PolicyEngine/policyengine-sim-api
-
Integration tests fail due to missing UV virtual environment setupPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
PolicyEngine/policyengine-sim-api#314 ·
Los mantenedores suelen responder en 1 día
-
Update policyengine to 6.3.4Posiblemente ocupada @policyengine la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 40/100
PolicyEngine/policyengine-sim-api#796 ·
Los mantenedores suelen responder en 1 día
-
Segmented US national runs wait on stuck regional children until the parent times outPosiblemente ocupada @anth-volk la tomó hoy. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
PolicyEngine/policyengine-sim-api#794 ·
Los mantenedores suelen responder en 1 día
-
Stage 12 coordinator can outlive its timeout while waiting and leaves workers runningPosiblemente ocupada @anth-volk la tomó hoy. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 20/100
PolicyEngine/policyengine-sim-api#792 ·
Los mantenedores suelen responder en 1 día
-
Stage 12 failure records keep only the exception class namePosiblemente ocupada @anth-volk la tomó hoy. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
PolicyEngine/policyengine-sim-api#790 ·
Los mantenedores suelen responder en 1 día
Todos los issues de PolicyEngine/policyengine-sim-api
Issues similares
-
Atomic append fails to create a missing filePosiblemente ocupada @harbinresearcher la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
fabiocaccamo/python-fsutil#201 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
task
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
danparshall/claude_researcher#87 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
GhostManager/Ghostwriter#998 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
datajoint/datajoint-python#1586 ·
Los mantenedores suelen responder en 1 día