[action-translation] resync: bayes_nonconj.md#163
Conversation
✅ Deploy Preview for astonishing-narwhal-a8fc64 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR forward-resyncs the Chinese translation of lectures/bayes_nonconj.md to match the current upstream lecture version, updating the narrative and examples to a modern NumPyro-only workflow (NUTS + AutoNormal SVI) and adding translation heading metadata.
Changes:
- Replaced the previous mixed Pyro/NumPyro + custom-class content with an updated NumPyro-only lecture structure (MCMC diagnostics, non-conjugate priors, SVI comparison).
- Added translation frontmatter (
translation: ... headings:) to map upstream headings to Chinese. - Added new translation sync state file at
.translate/state/bayes_nonconj.md.yml.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| lectures/bayes_nonconj.md | Full resync of the lecture content, examples, and translation frontmatter headings. |
| .translate/state/bayes_nonconj.md.yml | Records source SHA and resync metadata for the translation pipeline. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ```{include} _admonition/gpu.md | ||
| ``` |
| import numpy as np | ||
| import seaborn as sns | ||
| import matplotlib.pyplot as plt | ||
| import matplotlib as mpl | ||
| FONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf" | ||
| mpl.font_manager.fontManager.addfont(FONTPATH) | ||
| plt.rcParams['font.family'] = ['Source Han Serif SC'] | ||
|
|
||
| from scipy.stats import binom | ||
| import scipy.stats as st | ||
| import torch | ||
|
|
| chain_method="vectorized", | ||
| progress_bar=False, | ||
| ) | ||
| mcmc.run(random.key(seed), *args) |
| return mcmc | ||
| ``` | ||
|
|
||
| NumPyro建立在[JAX](https://docs.jax.dev)之上,而JAX显式地处理随机性:它不依赖全局随机状态,而是要求每次运行都拥有自己的**PRNG密钥**,这里通过`random.key(seed)`创建。 |
| - ('vonMises', kappa),其中kappa表示集中参数,中心位置设为$0.5$。 | ||
| - 注意:在使用`Pyro`时,这是原始vonMises分布的截断版本; | ||
| - 注意:在使用`Numpyro`时,这是**平移后**的分布。 | ||
| svi_result = svi.run(random.key(0), 5000, prior_ln, k, n, progress_bar=False) |
|
|
||
| return params, losses | ||
| vi_samples = guide.sample_posterior( | ||
| random.key(1), svi_result.params, sample_shape=(4000,) |
The resynced file keeps Chinese plot labels but reverted the import cell to the source's exact form, losing the Source Han Serif setup - Chinese in figures would render as missing glyphs. Residual #107 class found in the merge review; applied wave-wide. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Translation Quality ReviewVerdict: PASS | Model: claude-sonnet-5 | Date: 2026-07-19 📝 Translation Quality
Summary: This is a high-quality, accurate, and fluent translation that faithfully captures the technical content, mathematical derivations, and nuanced explanations of the English source. Terminology is consistent with standard Bayesian/statistical Chinese usage. Minor concerns include an added font-configuration code block not present in the source and a jupytext_version discrepancy, both of which are likely pipeline-related rather than translation quality issues. Consistent and accurate rendering of technical statistical/Bayesian terminology (e.g., 后验, 先验, 共轭对, 证据下界/ELBO, 有效样本量) matching standard usage Mathematical notation and LaTeX equations are fully preserved without corruption Code blocks are intact with accurately translated comments and docstrings Complex explanatory passages (e.g., on KL divergence derivation, NUTS mechanics) are translated with clarity and correct logical flow Heading structure and MyST directives (admonitions, code-cells, doc refs) are correctly preserved Suggestions:
🔍 Diff Quality
Summary: The target document has been fully resynced to match the current English source's structure, section order, and content, with a correctly populated translation heading map. Issues:
This review was generated automatically by action-translation review mode. |
…anslation#116) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Forward Resync: bayes_nonconj.md
Source: QuantEcon/lecture-python.myst — lectures/bayes_nonconj.md
Source commit:
b78fbcdThis PR resyncs the translation to match the current source document.
Reason: The two documents are almost entirely different. SOURCE describes a modern NumPyro-only lecture using NUTS and AutoNormal SVI with specific priors (uniform, truncated log-normal, truncated Laplace) and a streamlined workflow. TARGET is an older/different version using both Pyro and NumPyro, with additional priors (von Mises), rejection-sampling based truncated distributions, a full BayesianInference Python class implementation, beta-guide and truncated-normal guide SVI implementations, and different code/explanations not present in SOURCE at all. Conversely, SOURCE's specific content (data generation function, run_nuts helper, r_hat/ESS diagnostics discussion, trace plots, ELBO derivation details, comparison plots, 'Where to next' section) is missing from TARGET. Since TARGET contains substantial unique content (class implementation, pymc4/pyro dual support, von Mises prior, rejection sampling) not found in SOURCE, this is TARGET_HAS_ADDITIONS.
Changes
Whole-file resync applied. The entire document was resynced in a single pass.
Created by action-translation forward resync