Skip to content

Design note: a weighted module inside policyengine.py, replacing the microdf dependency #528

Description

@MaxGhenis

Tracking issue for docs/weighted-module-design.md, the decision record for replacing policyengine.py's microdf dependency with an internal policyengine.weighted module: pure numpy estimator kernels (shared with microcosm.frame.accounting), weights as an ordinary <entity>_weight column, and a closed df.weighted(...) accessor that exposes only weighted operations.

Context: the September 2026 review of microdf (PolicyEngine/microdf#315, #333) found that a pandas subclass cannot fail closed, and #527 found outputs/inequality.py reimplementing Gini and top shares with a different tie rule from microdf. microcosm-frame already declares itself microdf's successor.

The note fixes the three-layer design, pins every estimator definition against a named reference, and stages the migration: Stage 1 (module lands, inequality.py, decile_grouping.py and labor_supply_response.py move onto it), Stage 2 (MicroDataFrame leaves the public data model; major version), Stage 3 (engine return types; a separate decision).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions