Repository navigation
docs: add math for FoldedDistribution density - #2340
Conversation
Document the density of Y = |X| (p_Y(y) = p_X(y) + p_X(-y) for y >= 0) and the logsumexp form used by log_prob. Part of pyro-ppl#2187. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Benchmark reportthis PR - run time: 1 slower, 4 faster
compile time: unchanged across 32 benchmarksSignificant changes (5) ──────── run time ──────── ────── compile time ──────
benchmark baseline this PR Δ baseline this PR Δ
────────────────────────────────────────────────────────────────────────────────────────
- gamma_sample 10.0 ms 10.9 ms +8.8% 402.3 ms 457.0 ms +13.6%
+ lkj_cholesky_sample 2.3 ms 2.1 ms -7.3% 693.4 ms 691.2 ms -0.3%
+ nuts_dense_mass_funnel 716.4 ms 677.0 ms -5.5% 2.04 s 1.69 s -16.9%
+ svi_autodelta_map_logistic 199.0 ms 178.5 ms -10.3% 2.36 s 2.30 s -2.8%
+ svi_trace_mean_field_elbo 748.7 ms 691.7 ms -7.6% 4.00 s 4.09 s +2.2%Red is slower, green is faster; a row is coloured by the worse of its two columns. A delta in parentheses cleared the threshold on a measurement below the resolution floor, so it is shown without being called a change. † marks a benchmark that could not be compared — see below. Full results
|
| baseline | this PR | |
|---|---|---|
| ref | master |
doc/folded-distribution-math |
| commit | 31dcd985 |
e1d0aa40 |
| numpyro | 0.22.0 | 0.22.0 |
| jax | 0.11.2 | 0.11.2 |
| backend | cpu | cpu |
| python | 3.14.8 | 3.14.8 |
Runner: Linux-6.17.0-1022-azure-x86_64-with-glibc2.39, 4 CPUs.
Produced by this benchmark run.
|
Thanks for the PR! The math and the reST both look correct. One small wording suggestion and two optional nits below. Verified
Suggestion
Optional nits
When this merges, |
|
Thanks for the thorough check! Pushed e1d0aa4: the |
Summary
Adds the mathematical description of `FoldedDistribution`'s density to its docstring, as tracked in #2187 (documentation with math for distributions).
Docstring-only change: no code path is modified.
Verification
Not run: full test suite, `make doctest`, Sphinx build.
Part of #2187.
🤖 Generated with Claude Code