Skip to content

Commit c511b20

Browse files
Fix E306 lint error and update changelog for unadjusted outcome-model summary
The previous commit removed the unconditional aipw() call from _outcome_estimates_summary(), which left the nested _fmt_points definition with no preceding blank line (flake8 E306). Add it back. Also drop the '(see the changelog)' reference from the comment per review: the changelog summary section now explicitly documents that mu_DR/AIPW appears only when the frame is adjust()-calibrated, matching the new summary() behavior.
1 parent 564527e commit c511b20

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,12 @@ for the design rationale.
113113
weights are constant (`μ̂_DR` reduces to `μ̂_OM`). **Point estimate only** — no
114114
CI yet; see the TODOs in `balance/outcome_models/aipw.py`.
115115

116-
- **`summary()` reports the estimator trio** when a fitted outcome model and a
117-
target are both present: an "Outcome estimates" section with `μ̂_IPW` and its
118-
analytic CI, plus `μ̂_OM` and `μ̂_DR` as point estimates. **With no outcome model
119-
fit, `summary()` output is unchanged.** Separately,
116+
- **`summary()` reports outcome-model estimates** when a fitted outcome model
117+
and a target are both present: an "Outcome estimates" section with `μ̂_IPW` and
118+
its analytic CI, plus `μ̂_OM` as a point estimate, and `μ̂_DR` when the frame is
119+
`adjust()`-calibrated (its AIPW block needs those weights; an unadjusted frame
120+
with a fitted model is a supported workflow and omits it). **With no outcome
121+
model fit, `summary()` output is unchanged.** Separately,
120122
`outcomes_hat().summary()` **scopes any doubly-robust claim to the fit weights**
121123
— a linear learner with an intercept fit with non-uniform weights reports
122124
`"doubly robust w.r.t. weights <col>"`; everything else reports plain

balance/balance_frame.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3752,6 +3752,7 @@ def _outcome_estimates_summary(self) -> str | None:
37523752
for col in model["outcome_columns"]
37533753
if f"{col}_hat" in target_predictions.columns
37543754
}
3755+
37553756
def _fmt_points(estimates: dict[str, float]) -> str:
37563757
return "\n".join(
37573758
f" {col} {val:.3f}" for col, val in estimates.items()
@@ -3772,8 +3773,8 @@ def _fmt_points(estimates: dict[str, float]) -> str:
37723773

37733774
# μ̂_DR requires adjust()-calibrated responder weights on the same
37743775
# population scale as the target (``aipw()`` enforces this). A frame
3775-
# with a fitted outcome model but no adjust() is a supported workflow
3776-
# (see the changelog), so omit the AIPW block instead of crashing.
3776+
# with a fitted outcome model but no adjust() is a supported workflow,
3777+
# so omit the AIPW block instead of crashing.
37773778
if self.is_adjusted:
37783779
dr_estimates = {str(col): float(v) for col, v in self.aipw().items()}
37793780
blocks.extend(

0 commit comments

Comments
 (0)