🌐 [translation-sync] Update all lectures to use latest guide of jax random (recovery of #247) - #256
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 updates the zh-cn lecture sources to align with the latest JAX guidance for random key creation, syncing the translated lectures with the upstream QuantEcon source update (recovery of the previously closed sync PR).
Changes:
- Updated JAX / NumPyro examples to use
jax.random.key(seed)/random.key(seed)instead ofPRNGKey(...). - Refreshed notebook / MyST markdown scaffolding (e.g., jupytext metadata, minor layout/blank-line normalization, notebook header injection in one lecture).
- Updated translation-sync state YAML files to reflect the new upstream source SHA, model, and tool version.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lectures/aiyagari_egm.md | Switches key creation in JAX examples to jax.random.key and minor formatting sync. |
| lectures/ar1_bayes.md | Updates NumPyro RNG key creation; also includes figure label text changes. |
| lectures/back_prop.md | Updates JAX key creation in NN example code cells and formatting sync. |
| lectures/ifp_advanced.md | Updates key creation in JAX simulation code. |
| lectures/ifp_egm.md | Adds notebook header raw block; updates key creation in simulation code. |
| lectures/ifp_egm_transient_shocks.md | Updates key creation in JAX implementation sections and formatting sync. |
| lectures/lake_model.md | Updates jupytext metadata and key creation for Markov simulation. |
| lectures/mccall_fitted_vfi.md | Updates jupytext metadata and key creation in Monte Carlo / simulation helpers. |
| lectures/mccall_model.md | Updates jupytext metadata; updates key creation; updates docstrings referencing key type. |
| lectures/mccall_model_with_sep_markov.md | Updates key creation in simulation helpers and formatting sync. |
| lectures/mccall_persist_trans.md | Updates jupytext metadata and default key creation in helpers. |
| lectures/newton_method.md | Updates JAX key creation in high-dimensional example. |
| lectures/os_egm_jax.md | Updates JAX key creation for reproducible shock draws. |
| lectures/unemployment_linear.md | Updates NumPyro MCMC run key creation and formatting sync. |
| lectures/unemployment_shocks.md | Updates NumPyro MCMC run key creation and formatting sync. |
| .translate/state/aiyagari_egm.md.yml | Updates translation sync metadata (source SHA, model, tool version, mode). |
| .translate/state/ar1_bayes.md.yml | Updates translation sync metadata (source SHA, model, tool version, mode). |
| .translate/state/back_prop.md.yml | Updates translation sync metadata (source SHA, model, tool version, mode). |
| .translate/state/ifp_advanced.md.yml | Updates translation sync metadata (source SHA, tool version). |
| .translate/state/ifp_egm.md.yml | Updates translation sync metadata (source SHA, tool version, mode). |
| .translate/state/ifp_egm_transient_shocks.md.yml | Updates translation sync metadata (source SHA, model, tool version, mode). |
| .translate/state/lake_model.md.yml | Updates translation sync metadata (source SHA, tool version, mode). |
| .translate/state/mccall_fitted_vfi.md.yml | Updates translation sync metadata (source SHA, tool version, mode). |
| .translate/state/mccall_model.md.yml | Updates translation sync metadata (source SHA, tool version, mode). |
| .translate/state/mccall_model_with_sep_markov.md.yml | Updates translation sync metadata (source SHA, model, tool version, mode). |
| .translate/state/mccall_persist_trans.md.yml | Updates translation sync metadata (source SHA, tool version, mode). |
| .translate/state/newton_method.md.yml | Updates translation sync metadata (source SHA, synced date, tool version). |
| .translate/state/os_egm_jax.md.yml | Updates translation sync metadata (source SHA, model, tool version, mode). |
| .translate/state/unemployment_linear.md.yml | Updates translation sync metadata (source SHA, model, tool version, mode). |
| .translate/state/unemployment_shocks.md.yml | Updates translation sync metadata (source SHA, model, tool version, mode). |
Suppressed comments (1)
lectures/mccall_model.md:1062
- 这里把参数类型写成了
jax.random.key,但jax.random.key是创建 key 的函数名,不是类型名;作为文档类型标注会引起误解。建议把两处(simulate_lifetime_value与此处)统一改成更准确的类型描述(例如jax.Array/jax.random.KeyArray或保持与其他讲义一致的 key 类型写法)。
key : jax.random.key
JAX 的随机密钥
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| key, _ = random.split(key) | ||
| random_permutation = random.permutation(random.PRNGKey(1), indices) | ||
| random_permutation = random.permutation(random.key(1), indices) |
| ax.hist(ρ_cond, bins=50, density=True, alpha=0.5, | ||
| label='条件化假设') | ||
| label='conditioning assumption') | ||
| ax.hist(ρ_stat, bins=50, density=True, alpha=0.5, | ||
| label='平稳性假设') | ||
| ax.axvline(ρ_true, color='k', linestyle='--', lw=2, label='真实值') | ||
| label='stationary assumption') | ||
| ax.axvline(ρ_true, color='k', linestyle='--', lw=2, label='true value') |
| key : jax.random.key | ||
| JAX 的随机密钥 |
✅ Translation Quality ReviewVerdict: PASS | Model: claude-sonnet-5 | Date: 2026-08-19 📝 Translation Quality
Summary: This is a high-quality translation across all 15 changed lecture files. Mathematical content, code, and MyST formatting are faithfully preserved, and domain terminology generally follows the provided glossary and reads naturally in academic Simplified Chinese. Minor issues include inconsistent translation of 'root-finding' within newton_method.md, and a few slightly literal phrasings that could be smoothed for better fluency, but none of these affect technical accuracy or document usability. Mathematical notation, LaTeX equations, and code blocks are preserved accurately across all files with no corruption or omission Technical terminology from the glossary (e.g., 贝尔曼算子, 内生网格法, 遍历性, 蒙特卡洛, 牛顿法, 雅可比矩阵) is applied consistently and correctly throughout the changed sections MyST directives, exercise/solution blocks, and code-cell structures are all correctly preserved with proper spacing between Chinese text and inline directives Complex economic and statistical concepts (e.g., leave-one-out cross-validation, EGM operator derivations, mixture model specification) are translated with accurate technical fidelity while remaining readable Suggestions:
🔍 Diff Quality
Summary: Changes are minor JAX API updates (PRNGKey→key) and whitespace fixes correctly synced to translation without altering structure or headings. This review was generated automatically by action-translation review mode. |
Automated Translation Sync
This PR contains automated translations from QuantEcon/lecture-python.myst.
Source PR
#965 - Update all lectures to use latest guide of jax random key creation
Files Updated
lectures/aiyagari_egm.md.translate/state/aiyagari_egm.md.ymllectures/ar1_bayes.md.translate/state/ar1_bayes.md.ymllectures/back_prop.md.translate/state/back_prop.md.ymllectures/ifp_advanced.md.translate/state/ifp_advanced.md.ymllectures/ifp_egm.md.translate/state/ifp_egm.md.ymllectures/ifp_egm_transient_shocks.md.translate/state/ifp_egm_transient_shocks.md.ymllectures/lake_model.md.translate/state/lake_model.md.ymllectures/mccall_fitted_vfi.md.translate/state/mccall_fitted_vfi.md.ymllectures/mccall_model.md.translate/state/mccall_model.md.ymllectures/mccall_model_with_sep_markov.md.translate/state/mccall_model_with_sep_markov.md.ymllectures/mccall_persist_trans.md.translate/state/mccall_persist_trans.md.ymllectures/newton_method.md.translate/state/newton_method.md.ymllectures/os_egm_jax.md.translate/state/os_egm_jax.md.ymllectures/unemployment_linear.md.translate/state/unemployment_linear.md.ymllectures/unemployment_shocks.md.translate/state/unemployment_shocks.md.ymlDetails
This PR was created automatically by the translation action.
Recovery note: this PR recovers #247, auto-closed by the rebase force-push race on 2026-08-18 23:27:11Z (see the correction comment on #240 for the event-log analysis). Same branch; body restored verbatim from #247 so review mode can locate the Source PR reference.