Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .translate/state/bayes_nonconj.md.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source-sha: b78fbcddae98a645bff0f01bb28a1e7955db5f53
synced-at: "2026-07-18"
source-sha: d9caa8174ac100d375f2a0742b47fe6326b229ac
synced-at: "2026-10-05"
model: claude-sonnet-5
mode: RESYNC
mode: UPDATE
section-count: 6
tool-version: 0.17.0
tool-version: 0.29.3
8 changes: 6 additions & 2 deletions lectures/bayes_nonconj.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jupytext:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.16.4
jupytext_version: 1.17.2
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand Down Expand Up @@ -354,7 +354,11 @@ NumPyro通过让`TruncatedNormal`经过`ExpTransform`来构造这个分布。
def truncated_lognormal(μ, σ):
"截断到单位区间(0, 1]的对数正态分布。"
base = dist.TruncatedNormal(loc=μ, scale=σ, low=-jnp.inf, high=0.0)
return dist.TransformedDistribution(base, dist.transforms.ExpTransform())
# 声明(0, 1]这个支撑范围:单独使用ExpTransform会声明支撑为(0, ∞),
# 这会让采样器提议出θ > 1的取值
class _UnitLogNormal(dist.TransformedDistribution):
support = dist.constraints.interval(0.0, 1.0)
return _UnitLogNormal(base, dist.transforms.ExpTransform())

prior_ln = truncated_lognormal(0.0, 1.0)
mcmc_ln = run_nuts(binomial_model, prior_ln, k, n)
Expand Down
Loading