Skip to content

Extract the population-view harness from imputation-paper (#1) - #3

Merged
MaxGhenis merged 6 commits into
mainfrom
extract-harness
Jul 4, 2026
Merged

MaxGhenis merged 6 commits into
mainfrom
extract-harness

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

Summary

Extracts the population-view harness from
imputation-paper into this
package, behavior-preserving, and prepares it for a PyPI release and a JOSS
software note. Closes #1.

The package is evaluation-only and generator-agnostic: it scores any candidate
weighted population file against the surveys that observe it, and takes no
dependency on populace or any other generator. Public surface, per the issue:

  • popdgp.views — SurveyView, project_view, score_view,
    harness_scorecard (the projection-and-score harness that emits a per-view
    scorecard).
  • popdgp.metrics — the weighted joint/tail/stress metrics: energy_distance,
    prdc, classifier_two_sample_auc, weighted_wasserstein1,
    reweight_fragility.
  • popdgp.floors — split_frame, sample_reference_scorecard (a survey's own
    complementary split, scored as a candidate, anchoring every axis).

Per the issue's division of labor, the marginal task metrics (pinball loss,
zero-share error) stay in the paper repo; weighted_wasserstein1 comes across
(the tail block needs it) and reweight_fragility comes across (it is a
property of any weighted file, not of a task).

Behavior preservation

Fidelity is enforced by tests/test_parity.py, which imports the
imputation-paper originals when their source is available (a sibling checkout or
IMPUTATION_PAPER_SRC) and asserts the extracted functions reproduce them to
numerical equality on shared fixtures and seeds — including the private weighted
reductions the tail block reaches into, score_view with its tail block, and
the full harness_scorecard. When the source is absent the module skips
cleanly, so it never passes vacuously. Run locally against the sibling checkout,
all parity tests pass (they are exact-equality assertions, not tolerances).

Local verification (mirrors CI)

  • pytest: 29 passed (floors 6, metrics 10, parity 9, views 4) on Python
    3.13; the 9 parity tests ran against the sibling imputation-paper checkout.
  • ruff check . and ruff format --check .: clean.
  • uv build + uvx twine check dist/*: sdist and wheel build, both PASS.

JOSS note

Adds paper.md + paper.bib (the JOSS submission). Citations are the canonical
references for each metric — energy distance (Székely & Rizzo 2013), the
PRDC family (Naeem et al. 2020), the classifier two-sample test (Lopez-Paz &
Oquab 2017), and Wasserstein two-sample testing (Ramdas et al. 2017) — and the
prose makes factual claims only, cross-checked against the implementation.

The author block lists Max Ghenis as sole author with a TODO(authorship)
marker: the harness originated in imputation-paper, so the final author list
and order should be confirmed before submission. No co-authors are presumed.

LICENSE

Adds an MIT LICENSE file, materializing the license = { text = "MIT" }
already declared in pyproject.toml (JOSS requires an OSI-approved license file
and the repo had none). It is now packaged into the sdist and wheel. Note for
review: PolicyEngine's core packages (e.g. policyengine.py) are AGPL-3.0; MIT
here follows the committed pyproject declaration rather than a new choice — flag
if a different license is intended.

Not in scope (deliberately)

  • No PyPI publish (release prep only).
  • No changes to imputation-paper. The acceptance criterion — imputation-paper
    switching to a pinned popdgp and regenerating bit-identical tables — is a
    follow-up, guarded here by the parity suite.

🤖 Generated with Claude Code

MaxGhenis and others added 6 commits July 4, 2026 18:39
Behavior-preserving extraction of the population-view harness into the
standalone popdgp package:

- popdgp.metrics: energy_distance, prdc, classifier_two_sample_auc,
  weighted_wasserstein1, reweight_fragility, plus the private weighted
  reductions the view's tail block depends on. Metric definitions, caps,
  and defaults are copied verbatim from the paper's experiments/metrics.py
  (guardian-owned semantics). The task-only marginal metrics
  (weighted_pinball_loss, zero_share_error) stay in the paper repo.
- popdgp.views: SurveyView, project_view, score_view, harness_scorecard,
  identical to experiments/views.py apart from the metrics import.
- popdgp.floors: split_frame/Split (from the paper's holdout.py) plus
  sample_reference_scorecard, a generator-agnostic form of the harness's
  scf_sample_reference sampling-noise floor.

Packaging per the sibling repos: uv + hatchling, ruff, pytest, and a CI
workflow (test matrix 3.11-3.13, ruff, and a build/twine-check step for
PyPI release prep). Does not modify imputation-paper.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Resume spec: #1. Diff against origin/main for state; work is
incomplete and unreviewed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… state

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
29/29 tests pass (parity ran against sibling paper checkout, bit-identical);
ruff check + format --check clean; uv build + twine check pass. Mirrors CI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
paper.md: sole author Max Ghenis (ORCID 0000-0002-1335-8277), with
TODO(authorship) markers for pending author-list alignment and no presumed
co-authors. Canonical citations for energy distance (Szekely & Rizzo 2013),
PRDC (Naeem et al. 2020), C2ST (Lopez-Paz & Oquab 2017), and Wasserstein
(Ramdas et al. 2017); factual claims only, cross-checked against the source.

LICENSE: MIT, materializing the license already declared in pyproject
(JOSS requires an OSI license file); now packaged into the sdist and wheel.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review July 4, 2026 18:35
@MaxGhenis
MaxGhenis merged commit 402fb23 into main Jul 4, 2026
5 checks passed
@MaxGhenis
MaxGhenis deleted the extract-harness branch July 4, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract the harness from imputation-paper (behavior-preserving), release to PyPI, JOSS note

1 participant