Skip to content

Commit 1833274

Browse files
release: v1.6.0 — P1 Agent-Native × Frontier + agent-native infrastructure
Minor release pushing two competitive axes simultaneously. Agent-native: - sp.paper() end-to-end publication pipeline (PaperDraft → md/tex/docx) - sp.llm_dag_constrained / sp.llm_dag_validate closed-loop LLM-DAG - sp.pc_algorithm(forbidden=, required=) constrained PC - sp.text_treatment_effect / sp.llm_annotator_correct (causal_text MVP) - Typed exception taxonomy: StatsPAIError + 6 subclasses, each with recovery_hint / diagnostics / alternative_functions; 13 call-site migrations across DID/IV/matching/DML-IRM/synth/Bayesian-DML - 36 populated agent cards via sp.agent_card / sp.agent_cards - CausalResult.violations() / .to_agent_summary() on both result classes - 26 auto-rendered ## For Agents blocks across 19 guides, CI-enforced Methodological frontier: - 5 new MR frontier estimators: sp.mr_lap, sp.mr_clust, sp.grapple, sp.mr_cml, sp.mr_raps (all routed via sp.mr(method=...)) - sp.dml_panel — Semenova-Chernozhukov long-panel Double-ML with unit-split cross-fitting and cluster-robust SE Tests: 231 new/extended + 317 domain regression all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c87af29 commit 1833274

49 files changed

Lines changed: 4126 additions & 114 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 141 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,29 @@
22

33
All notable changes to StatsPAI will be documented in this file.
44

5-
## [Unreleased]v1.6 P1 Agent-Native × Frontier (MR + LLM-DAG + Paper + Causal-Text)
5+
## [1.6.0]2026-04-21 — P1 Agent-Native × Frontier + Agent-Native Infrastructure
66

77
Pure-additive release pushing two competitive axes:
88

99
- **Agent-native** — closed-loop LLM-DAG, end-to-end `sp.paper()`
10-
pipeline, full registry/agent-card metadata for every new function.
11-
- **Methodological frontier** — four post-2020 Mendelian-randomization
12-
estimators *and* two `causal_text` MVPs (text-as-treatment,
10+
pipeline, full registry/agent-card metadata for every new function,
11+
typed exception taxonomy (`StatsPAIError` + 6 subclasses) with
12+
`recovery_hint` / `diagnostics` / `alternative_functions` payloads,
13+
result-object `.violations()` / `.to_agent_summary()` methods, and
14+
auto-generated `## For Agents` blocks in every flagship guide.
15+
- **Methodological frontier** — five post-2020 Mendelian-randomization
16+
estimators (`mr_lap`, `mr_clust`, `grapple`, `mr_cml`, `mr_raps`),
17+
long-panel Double-ML (`sp.dml_panel`), constrained LLM-assisted PC
18+
discovery, and two `causal_text` MVPs (text-as-treatment,
1319
LLM-annotator measurement-error correction).
1420

1521
Together: one new top-level pipeline (`sp.paper`), four new LLM-aware
1622
dag/text estimators (`sp.llm_dag_constrained`, `sp.llm_dag_validate`,
1723
`sp.text_treatment_effect`, `sp.llm_annotator_correct`), constrained
18-
PC discovery (`sp.pc_algorithm(forbidden=, required=)`), and four MR
19-
frontier estimators (`sp.mr_lap` etc., described below).
24+
PC discovery (`sp.pc_algorithm(forbidden=, required=)`), five MR
25+
frontier estimators (`sp.mr_lap` etc.), one long-panel DML estimator
26+
(`sp.dml_panel`), 36 populated agent cards (was 0 pre-v1.5.1), and 26
27+
`## For Agents` blocks across 19 guides.
2028

2129
### Added — P1-A: closed-loop LLM-assisted causal discovery
2230

@@ -94,24 +102,43 @@ frontier estimators (`sp.mr_lap` etc., described below).
94102
pleiotropy, MR-cML-BIC variant (Xue, Shen & Pan 2021). Block-
95103
coordinate descent jointly updates causal β, true exposure effects,
96104
and a K-sparse pleiotropy vector; K selected by BIC.
105+
- **`sp.mr_raps`** — Robust Adjusted Profile Score (Zhao, Wang,
106+
Hemani, Bowden & Small 2020, *Annals of Statistics* 48(3)).
107+
Profile-likelihood MR with Tukey biweight loss + log-variance
108+
adjustment; same structural model as GRAPPLE but resistant to
109+
gross pleiotropy outliers. Sandwich SE from M-estimator formula.
110+
111+
### Added — v1.7 long-panel DML (`src/statspai/dml/panel_dml.py`)
112+
113+
- **`sp.dml_panel`** — Long-panel Double/Debiased ML (Semenova-
114+
Chernozhukov 2023 simplified). Absorbs unit (and optional time)
115+
fixed effects via within-transform, cross-fits ML nuisance learners
116+
with folds that **split units** (Liang-Zeger compatible), reports
117+
cluster-robust SE at the unit level. PLR moment for continuous or
118+
binary treatment; empty-covariate fallback reduces to pure FE-OLS.
97119

98120
### Added — dispatcher + registry wiring
99121

100122
- `sp.mr(method=...)` routes `mr_lap | lap | sample_overlap`,
101123
`mr_clust | clust | clustered`, `grapple | profile_likelihood`,
102-
`mr_cml | cml | constrained_ml` to the new estimators.
103-
- All four registered in `registry.py` with full `ParamSpec` metadata,
104-
category `"mendelian"`, tags, and reference. `sp.describe_function`,
105-
`sp.function_schema`, and `sp.agent_card` now cover them.
106-
- `statspai.list_functions()` grows from 902 to 906 top-level entries
107-
(+4 new MR frontier functions).
108-
109-
### Added — tests (`tests/test_mr_frontier.py`)
110-
111-
- 34 tests covering correctness, boundary validation, cross-method
112-
consistency (`mr_lap` with `overlap=0` == IVW; `mr_cml` with `K=0`
113-
≈ IVW; `mr_clust` two-cluster DGP detection), dispatcher routing,
114-
and registry/schema export.
124+
`mr_cml | cml | constrained_ml`, `mr_raps | raps |
125+
robust_profile_score` to the new estimators.
126+
- All six new functions (5 MR + `dml_panel`) registered in
127+
`registry.py` with full `ParamSpec` metadata, category, tags, and
128+
reference. `sp.describe_function`, `sp.function_schema`, and
129+
`sp.agent_card` cover them.
130+
131+
### Added — tests
132+
133+
- `tests/test_mr_frontier.py` — 41 tests covering correctness,
134+
boundary validation, cross-method consistency (`mr_lap` with
135+
`overlap=0` == IVW; `mr_cml` with `K=0` ≈ IVW; `mr_clust`
136+
two-cluster DGP; `mr_raps` outlier-robustness vs IVW), dispatcher
137+
routing, and registry/schema export.
138+
- `tests/test_dml_panel.py` — 13 tests covering recovery under
139+
homogeneous treatment, FE-OLS agreement in the no-confounding
140+
limit, cluster-SE vs iid SE under AR(1) within-unit correlation,
141+
time-FE option, boundary validation, and registry metadata.
115142

116143
### Deferred (originally scoped for v1.6)
117144

@@ -122,10 +149,11 @@ frontier estimators (`sp.mr_lap` etc., described below).
122149
CAUSE will land in a later release once reference-parity
123150
infrastructure is in place.
124151

125-
## [Prior-Unreleased]Agent-native infrastructure
152+
### Agent-native infrastructure (foundation for v1.6.0)
126153

127-
Pure-additive release targeting agent-native adoption: every layer
128-
now speaks in structured data with recovery hints, not prose.
154+
Every layer now speaks in structured data with recovery hints, not
155+
prose — this is the foundation the P1 frontier estimators above build
156+
on.
129157

130158
### Added — agent-native exception taxonomy (`statspai.exceptions`)
131159

@@ -234,11 +262,100 @@ now speaks in structured data with recovery hints, not prose.
234262
/ Bayesian-DID / TMLE / causal-forest / agent-native suites
235263
continue to pass.
236264

265+
### Added — agent-native round 3 (v1.6 sprint)
266+
267+
- **Nine more flagship agent cards**: `sp.dml_panel` (v1.7 long panel
268+
DML), `sp.proximal` (+ bidirectional/fortified PCI alternatives
269+
exposed), `sp.mr` (dispatcher for the full MR family), `sp.qdid`,
270+
`sp.qte`, `sp.dose_response`, `sp.spillover`, `sp.multi_treatment`,
271+
`sp.network_exposure`. `sp.agent_cards()` now returns **30 populated
272+
entries** (was 19 after the prior sprint).
273+
- **Thirteen more guide `## For Agents` blocks** (26 total across 19
274+
guides): `proximal_family.md`, `mendelian_family.md`,
275+
`qte_family.md` (qte + qdid), `interference_family.md` (spillover +
276+
network_exposure), `harvest_did.md` (did + callaway_santanna),
277+
`causal_text_family.md` (text_treatment_effect +
278+
llm_annotator_correct), `llm_dag_family.md` (llm_dag_constrained +
279+
llm_dag_validate), `paper_pipeline.md` (paper).
280+
- **`paper` spec cleanup**`alternatives` entries now use bare
281+
function names (`"causal"`, `"recommend"`) instead of prose strings,
282+
so the renderer emits `sp.causal` rather than `sp.sp.causal: ...`.
283+
- **Six more call-site exception migrations** with recovery hints:
284+
- `sp.match` non-binary treatment → `MethodIncompatibility`
285+
pointing at `sp.multi_treatment` / `sp.dose_response`
286+
- `sp.match` all-same treatment → `DataInsufficient`
287+
- `sp.ebalance` < 2 treated-or-control → `DataInsufficient`
288+
- `sp.dml(model='irm')` non-binary D → `MethodIncompatibility`
289+
- `sp.dml(model='irm')` constant D → `IdentificationFailure`
290+
- `sp.conformal_synth` / `sp.augsynth` insufficient pre/post
291+
periods → `DataInsufficient`
292+
- **6 new migration tests** added to
293+
`tests/test_exception_migrations.py` (13 total now). All existing
294+
DID / IV / matching / DML / meta-learners / TMLE / synth / Bayesian
295+
family suites (363 tests total) continue to pass.
296+
297+
### Added — agent-native round 4 (v1.6 closed-loop)
298+
299+
- **Seven more flagship agent cards**: `sp.principal_strat`
300+
(extended), `sp.mediate`, `sp.bartik`, `sp.bayes_rd`,
301+
`sp.bayes_fuzzy_rd`, `sp.bayes_mte`, `sp.conformal` (extended).
302+
`sp.agent_cards()` now returns **36 populated entries**
303+
(30 → 36).
304+
- **Two more guide `## For Agents` blocks** (28 total across 21
305+
guides): `conformal_family.md` (conformal),
306+
`shift_share_political_panel.md` (bartik). Drift-check passes.
307+
- **Six more exception migrations** with recovery hints:
308+
- `sp.gsynth` < 3 pre-periods → `DataInsufficient` pointing at
309+
`sp.synth` / `sp.did`
310+
- `sp.gsynth` < 1 post-period → `DataInsufficient`
311+
- `sp.sbw` non-binary treatment → `MethodIncompatibility`
312+
pointing at `sp.multi_treatment` / `sp.dose_response`
313+
- `sp.optimal_match` missing control arm → `DataInsufficient`
314+
- `sp.synth_survival` no donor → `DataInsufficient`
315+
- **Closed-loop `sp.diagnose_result`**: the diagnostic battery output
316+
now also carries:
317+
- `violations` — the structured output of `result.violations()`
318+
(already surfaces pre-trend / first-stage F / McCrary / rhat /
319+
ESS / divergences / overlap / SMD with severity + recovery_hint),
320+
- `next_steps` — the output of
321+
`result.next_steps(print_result=False)`.
322+
The printed version includes a new "Structured violations
323+
(agent-native)" section below the family battery so humans and
324+
agents see the same triage picture. Backwards compatible: the
325+
existing `method_type` / `checks` keys are untouched.
326+
- **3 new migration tests** + **8 new closed-loop tests** added to
327+
`tests/test_exception_migrations.py` and
328+
`tests/test_diagnose_result_closed_loop.py`.
329+
- **Self-audit fix**: the `rdrobust` card's alternatives list used
330+
`rd_donut` (not exposed as a top-level function); replaced with
331+
`rdrbounds`. Doc block re-synced; drift-check green.
332+
333+
### Final tally (rounds 1 – 4 combined)
334+
335+
- **36 populated agent cards** covering: regression / IV / DID /
336+
RD / synth / matching / DML / meta-learners / TMLE / Bayesian
337+
(DID/IV/DML/RD/fuzzy-RD/MTE) / proximal / MR / principal strat /
338+
mediation / Bartik / QTE / QDID / dose-response / spillover /
339+
multi-treatment / network exposure / conformal / DML panel /
340+
paper / causal text / LLM-DAG.
341+
- **28 `## For Agents` blocks** across **21 guides**, rendered by
342+
`python scripts/sync_agent_blocks.py` with a CI drift guard.
343+
- **19 call-site exception migrations** to the typed taxonomy
344+
(`MethodIncompatibility`, `DataInsufficient`,
345+
`IdentificationFailure`, `NumericalInstability`) across DID / IV
346+
/ DML / matching / synth / Bayes. All still inherit from
347+
`ValueError` / `RuntimeError`, so existing `except` blocks work
348+
unchanged.
349+
- **Closed-loop `sp.diagnose_result`** bridges fit → violations →
350+
next_steps in one call, merging the family battery with the
351+
structured agent-native view.
352+
237353
### Migration notes
238354

239355
This release is purely additive. Existing call sites that catch
240-
`ValueError` continue to catch `AssumptionViolation` and
241-
`DataInsufficient`; catching `RuntimeError` continues to catch
356+
`ValueError` continue to catch `AssumptionViolation` /
357+
`DataInsufficient` / `MethodIncompatibility` /
358+
`IdentificationFailure`; catching `RuntimeError` continues to catch
242359
`ConvergenceFailure` and `NumericalInstability`. New code in
243360
StatsPAI should prefer the specific subclasses and attach a
244361
`recovery_hint` so agents can act on failures without parsing

0 commit comments

Comments
 (0)