Skip to content

feat(diagnostics): E-BFMI, treedepth saturation, stability plot, reserved-prefix doc - #224

Open
thomaspinder wants to merge 1 commit into
feat/142-convergence-reportfrom
feat/179-180-182-convergence-followups
Open

feat(diagnostics): E-BFMI, treedepth saturation, stability plot, reserved-prefix doc#224
thomaspinder wants to merge 1 commit into
feat/142-convergence-reportfrom
feat/179-180-182-convergence-followups

Conversation

@thomaspinder

Copy link
Copy Markdown
Owner

Summary

Three follow-ups on the convergence-report branch (#176), stacked on feat/142-convergence-report:

  • feat: E-BFMI and max-treedepth saturation in the convergence report #180: the report now carries E-BFMI (warn < 0.3, Betancourt 2016) and max-treedepth saturation (count + rate; warn at ≥ 1%, threshold argued in ADR-0008 — no literature standard exists, and surfacing every stray hit trains users to skim) with backend name-mapping (reached_max_treedepth pymc / maxdepth_reached nutpie, warmup groups excluded), coded messages, configurable thresholds, and None fields when sampler stats are absent (conjugate fits — no status degradation). Both are warnings, never failures: efficiency pathologies, remediable without changing the model — the docstring and ADR argue the distinction. Verified against a real nutpie fit.
  • feat: stability plot — spectral-radius histogram and unit-circle eigenvalue scatter #179: StabilitySummary.plot() — spectral-radius histogram with a unit-root line plus companion eigenvalues on the complex plane with the unit circle. Storage decision: the summary now retains a capped (≤200 draws, deterministic stride) chain-pooled eigenvalue subset, computed in the same pass that already produced the radii — zero extra compute, no 15 MB frozen-result bloat, and the house no-arg .plot() convention holds.
  • docs: document the reserved v{i}_ posterior-variable prefix for adapter authors #182: the VolatilityProcess protocol docstring now names the v{i}_ posterior-variable prefix as reserved for volatility latents, pointing adapter authors at posterior_var_names().

Closes #179
Closes #180
Closes #182

Gates

154 targeted tests green (+29 new); branch fast suite 670 passed; slow real-NUTS test green; ruff/ty clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Egjd7ToFeb9TQqFnfRQZxV

@codecov-commenter

codecov-commenter commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.98990% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.3%. Comparing base (388ec52) to head (62561e8).

Files with missing lines Patch % Lines
src/impulso/diagnostics.py 98.5% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                     Coverage Diff                     @@
##           feat/142-convergence-report    #224   +/-   ##
===========================================================
  Coverage                         95.2%   95.3%           
===========================================================
  Files                               47      48    +1     
  Lines                             3402    3495   +93     
  Branches                           420     431   +11     
===========================================================
+ Hits                              3242    3334   +92     
  Misses                             114     114           
- Partials                            46      47    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thomaspinder
thomaspinder force-pushed the feat/142-convergence-report branch 2 times, most recently from 7d32bea to daf27e5 Compare July 29, 2026 21:06
Three follow-ups cut from the convergence report in #142.

E-BFMI and max-treedepth saturation join the report (#180). Both are read
from the post-warmup `sample_stats` only; energy shares a name across
backends, treedepth needs a map (`reached_max_treedepth` in PyMC,
`maxdepth_reached` in nutpie). Thresholds are `ebfmi_warn=0.3` (Betancourt
2016) and `treedepth_warn_rate=0.01`, the latter chosen rather than sourced:
a handful of deep trees in a long run costs wall-clock time and nothing
else, so the report stays silent below one transition in a hundred. Both
warn and neither fails — they are efficiency pathologies, remediable by
changing the sampler or the parameterisation, and distinct from a divergence
or an unmixed R-hat, which say the draws are wrong.

The `v{i}_` posterior-variable prefix is now documented as reserved on the
`VolatilityProcess` protocol, where adapter authors will see it (#182);
previously it was stated only in ADR-0008, so a hand-registered `v2_gdp`
would have been silently routed to the volatility block.

`plot_stability` draws the spectral-radius posterior beside the companion
roots on the unit circle, reached as `report.stability.plot()` (#179). The
eigenvalues it scatters are stored on `StabilitySummary` as a chain-pooled,
strided subset capped at 200 draws, computed from the one eigendecomposition
the radii already require: keeping the full spectrum would put ~15 MB on a
frozen result for a large system, and the panel cannot resolve more points
than that anyway.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Egjd7ToFeb9TQqFnfRQZxV
@thomaspinder
thomaspinder force-pushed the feat/179-180-182-convergence-followups branch from 059164a to 62561e8 Compare July 29, 2026 21:59
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.

2 participants