Commit 6d59fe8
feat: v0.9.15 — BayesianMTEResult.tidy(terms=[...]) multi-row output
Completes the broom-pipeline integration of v0.9.13's per-population
ATT/ATU uncertainty. Users can now pd.concat ATE/ATT/ATU rows across
fits in a single call.
Added:
- BayesianMTEResult.tidy(conf_level=None, terms=None) override.
terms=None (default) unchanged → single ATE row. Single-string
terms='ate'/'att'/'atu' → single row of that term. List like
['ate', 'att', 'atu'] → multi-row DataFrame with 9-column schema.
Invalid term names raise ValueError.
- BayesianMTEResult now carries att_prob_positive and
atu_prob_positive fields (NaN-defaulted for pre-v0.9.15
snapshot back-compat). Populated by _integrated_effect from the
per-draw ATT/ATU posteriors.
- _integrated_effect returns a 5-tuple (mean, sd, hdi_lower,
hdi_upper, prob_positive) instead of 4-tuple. Caller updated
accordingly.
Round B review: 1 HIGH. Round C fixed:
- HIGH-1: default tidy() emits term='ate (integrated mte)' (via
parent estimand.lower()) but tidy(terms='ate') emitted short
literal 'ate'. Mixing both call styles in a concat pipeline
would have produced inconsistent labels for the same term.
Fixed by routing the 'ate' branch through
self.estimand.lower() so both paths produce byte-identical
rows. ATT / ATU keep short labels (no parent-default precedent;
short is natural for new terms). Regression test
test_tidy_ate_matches_default_path asserts exact parity.
- Round C re-review: zero ship-blockers.
Tests:
- tests/test_bayes_mte_tidy.py (13 tests) — back-compat default,
single-term paths, multi-row preservation of order, concat
workflow, invalid-term rejection (single + mixed with valid),
NaN prob_positive stub back-compat, prob_positive scalars
populated on real fits, default-vs-explicit label byte-parity
(Round-C regression).
- Bayesian family suite: 101/101 focused tests green in 2:14.
Design spec: docs/superpowers/specs/2026-04-20-v0915-tidy-multiterm.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent db050de commit 6d59fe8
3 files changed
Lines changed: 95 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
5 | 63 | | |
6 | 64 | | |
7 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| 83 | + | |
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| |||
110 | 113 | | |
111 | 114 | | |
112 | 115 | | |
| 116 | + | |
113 | 117 | | |
114 | 118 | | |
115 | 119 | | |
| |||
124 | 128 | | |
125 | 129 | | |
126 | 130 | | |
| 131 | + | |
127 | 132 | | |
128 | 133 | | |
129 | 134 | | |
| |||
161 | 166 | | |
162 | 167 | | |
163 | 168 | | |
164 | | - | |
165 | | - | |
| 169 | + | |
| 170 | + | |
166 | 171 | | |
167 | 172 | | |
168 | 173 | | |
169 | 174 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
174 | 179 | | |
175 | 180 | | |
176 | 181 | | |
177 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
178 | 204 | | |
179 | 205 | | |
180 | 206 | | |
| |||
241 | 267 | | |
242 | 268 | | |
243 | 269 | | |
244 | | - | |
| 270 | + | |
245 | 271 | | |
246 | 272 | | |
247 | 273 | | |
| |||
252 | 278 | | |
253 | 279 | | |
254 | 280 | | |
| 281 | + | |
255 | 282 | | |
256 | 283 | | |
257 | 284 | | |
| |||
0 commit comments