Register weighted-microdata rules: weights aren't values
維護者通常 2 天內回覆
評估
研究方向
The work is registering four rules in rules/registry.toml plus AST guards for the shapes they describe. Read the issue's list of rule IDs and the cited Simulation API line first, then check whether linked pull request #3938 already covers them, since it is still open. Done means the three guarded rules are enforced with no findings on the current code, and the doc-only rule is registered.
由索引模型根據 Issue 內容生成。
描述
Problem
A weighted MicroSeries or MicroDataFrame weights every .sum(), .mean() and .count(). Aggregating a weight column through one weights it by itself, and returns the sum of squared weights.
That happened in the Simulation API (PolicyEngine/policyengine-sim-api#766, fixed by PolicyEngine/policyengine-sim-api#767). budget.households was about 10^4 times too high on every run, and its test missed it because it used plain pd.DataFrames.
Once the unused economy comparison module is removed, nothing in the Public API handles microdata. Nothing stops new code from making the same mistake, though.
Proposal
Phase 1 step 1.9. Register the rule that weights aren't values, plus AST guards for the shapes a source check can recognise, in rules/registry.toml:
api.microdata.weights-not-values(doc-only): weights, values, labels and counts each allow different operations.api.microdata.weights-not-aggregated-as-values: a weight is never the value of a weightedMicroSeries, the variable of a weighted aggregator, orframe[<weight>]followed by a weighted reduction.api.microdata.weight-stripping-confined: raw values (np.array,.values,.to_numpy()and so on) are read from weighted microdata only in a designated module. None is designated yet.api.microdata.unweighted-series-are-labels: aMicroSeriesbuilt withoutweights=is only a grouping or filter key.
The aggregation rule's proof is the real pre-#767 Simulation API line. With no current code in scope, all three guarded rules start enforced, with no findings.
- 主要語言
- Python
- 星號
- 18
- 分支
- 33
- 平均合併
- 2 天 18 小時
- 30 天內合併 PR
- 105
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
PolicyEngine/policyengine-api 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
PolicyEngine/policyengine-api#4037 ·
維護者通常 2 天內回覆
-
難度 1/5 1-3 小時 新手友好度 88/100
PolicyEngine/policyengine-api#3911 ·
維護者通常 2 天內回覆
-
難度 1/5 1 小時以內 新手友好度 82/100
PolicyEngine/policyengine-api#3910 ·
維護者通常 2 天內回覆
-
Update PolicyEngine bundle to 6.15.0可能已有人在做 @policyengine 今天認領。 未關閉
難度 1/5 1 小時以內 新手友好度 1/100
PolicyEngine/policyengine-api#4214 ·
維護者通常 2 天內回覆
-
Define each country's years once and refuse society-wide requests for other years可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 4/5 3-5 天 新手友好度 54/100
PolicyEngine/policyengine-api#4211 ·
維護者通常 2 天內回覆
查看 PolicyEngine/policyengine-api 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
fritzprix/libr-agent#2612 ·
維護者通常 1 天內回覆
-
needs-triage presubmit-gate
難度 2/5 1-3 小時 新手友好度 76/100
gke-labs/kube-agents#5001 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
simonw/sqlite-utils#928 ·
維護者通常 3 天內回覆
-
colorado
難度 2/5 1-3 小時 新手友好度 72/100
freelawproject/juriscraper#2405 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
cline/mcp-marketplace#3576 ·