Skip to content

Retain raw propensity scores in DoubleMLIRM - #405

Merged
SvenKlaassen merged 2 commits into
DoubleML:mainfrom
leninworld:feat-raw-propensity-issue-258
Sep 20, 2026
Merged

SvenKlaassen merged 2 commits into
DoubleML:mainfrom
leninworld:feat-raw-propensity-issue-258

Conversation

@leninworld

@leninworld leninworld commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

This PR fixes issue #258.

Description

This adds a read-only raw_propensity property to DoubleMLIRM. When fit(store_predictions=True) is used, raw cross-fitted propensity predictions are copied into a dedicated array before the configured propensity-score processor clips or normalizes them. When store_predictions=False, raw_propensity remains None, matching the storage setting requested in the review feedback.

The implementation covers both internally estimated and externally supplied propensity predictions, resets state on repeated fits, returns a copy so callers cannot mutate fitted state, and documents the (n_obs, n_rep, n_coefs) shape. Existing prediction-key invariants and fit results remain unchanged.

Reference to Issues or PRs

This is the prerequisite portion of #258. It exposes the raw scores needed by a later log-odds overlap diagnostic without adding that diagnostic in this PR.

Related to #258.

Validation

  • exact P3 head b69f86ef7bdb50d3f9e94fbaf40f18ce050f13d2: affected propensity, external-prediction, and return-type tests — 79 passed, 20 warnings
  • changed-file test module on the identical I2 tree — 16 passed
  • complete IRM test directory on the identical I2 tree — 2,837 passed, 64 skipped
  • Ruff lint, Ruff format, and git diff --check on the exact P3 head — passed
  • an earlier repository-wide run reached 92% before manual interruption: 7,235 passed, 66 skipped; the large RDD error cluster was caused by the missing optional rdrobust dependency, and 15 other failures occurred outside the changed IRM files. This run is not counted as passing validation.

Validation evidence

The screenshot below records the initial P2 validation at head 42c37b6. It is retained as historical evidence; the current P3/I2 exact-head validation is reported above.

DoubleML Stage 3 validation at P2 head 42c37b6

Scope

No log-odds diagnostic is included here. No existing prediction keys, estimator outputs, or serialization contracts are changed.

PR Checklist

  • The title of the pull request summarizes the changes made.
  • The PR contains a detailed description of all changes and additions.
  • References to related issues or PRs are added.
  • The code passes the affected and complete IRM unit-test suites.
  • Enhancements or new feature are equipped with unit tests.
  • The changes adhere to the PEP8 standards.

@SvenKlaassen

Copy link
Copy Markdown
Member

Hi @leninworld,

thank you that looks fine. One small comment.
I would suggest to only store the raw propensity scores if store_predictions=True, but that shouldnt be a large change.

@leninworld

Copy link
Copy Markdown
Contributor Author

Hi @leninworld,

thank you that looks fine. One small comment. I would suggest to only store the raw propensity scores if store_predictions=True, but that shouldnt be a large change.

Done. Thanks @SvenKlaassen

@SvenKlaassen
SvenKlaassen merged commit 4e51b3e into DoubleML:main Sep 20, 2026
9 checks passed
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.

[Feature Request]: Overlap diagnostics for propensity scores

2 participants