[action-translation] resync: kesten_processes.md#190
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/kesten_processes.md to match the current upstream (source) lecture content and updates translation sync state metadata.
Changes:
- Added translation frontmatter metadata (title + heading mapping) and included the GPU admonition include.
- Updated code cells to upstream-style implementations (e.g.,
default_rng-based randomness, consolidatedpip install, refreshed examples). - Replaced the previous Numba-based solution for the firm-dynamics exercise with a JAX-based implementation and recorded the new sync state in
.translate/state/.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| lectures/kesten_processes.md | Resynced the full lecture content and updated code examples/solutions (incl. RNG + JAX) and translation metadata. |
| .translate/state/kesten_processes.md.yml | Added resync state (source SHA, sync date, model, mode). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ```{code-cell} ipython3 | ||
| 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'] | ||
|
|
||
| plt.rcParams["figure.figsize"] = (11, 5) #设置默认图形大小 | ||
| import numpy as np | ||
| import quantecon as qe | ||
| ``` | ||
|
|
||
| 以下两行仅用于避免pandas和matplotlib之间的兼容性问题导致的`FutureWarning`。 | ||
|
|
||
| ```{code-cell} ipython | ||
| from pandas.plotting import register_matplotlib_converters | ||
| register_matplotlib_converters() | ||
| import yfinance as yf |
| for t in range(ts_length - 1): | ||
| ξ = rng.standard_normal() | ||
| σ2 = α_0 + σ2 * (α_1 * ξ**2 + β) | ||
| r[t] = np.sqrt(σ2) * np.random.randn() | ||
| r[t] = np.sqrt(σ2) * rng.standard_normal() | ||
| return r |
| ax.plot(garch_ts(rng), alpha=0.7) | ||
|
|
||
| ax.set(xlabel='时间', ylabel='$\\sigma_t^2$') | ||
| ax.set(xlabel="时间", ylabel="$\\sigma_t^2$") |
| "在给定一个新的随机密钥的情况下,更新单个企业的规模s。" | ||
| a_key, b_key, e_key = jax.random.split(key, 3) | ||
| a = jnp.exp(firm.μ_a + firm.σ_a * jax.random.normal(a_key)) | ||
| b = jnp.exp(firm.μ_b + firm.σ_b * jax.random.normal(b_key)) | ||
| e = jnp.exp(firm.μ_e + firm.σ_e * jax.random.normal(e_key)) | ||
| return jnp.where(s < firm.s_bar, e, a * s + b) |
| @partial(jax.jit, static_argnames=("T", "M")) | ||
| def generate_draws(firm, s_init=1.0, T=500, M=1_000_000, seed=0): | ||
| keys = jax.random.split(jax.random.PRNGKey(seed), M) | ||
|
|
||
| def sim_firm(key): | ||
| step_keys = jax.random.split(key, T) | ||
| s_final, _ = jax.lax.scan( | ||
| lambda s, k: (update(s, k, firm), None), s_init, step_keys | ||
| ) | ||
| return s_final | ||
|
|
||
| return jax.vmap(sim_firm)(keys) |
| return jnp.where(s < firm.s_bar, e, a * s + b) | ||
| ``` | ||
|
|
||
| 我们使用`lax.scan`对一个企业模拟`T`期,然后使用`vmap`并行运行所有`M`个企业。 |
✅ Translation Quality ReviewVerdict: PASS | Model: claude-sonnet-5 | Date: 2026-07-21 📝 Translation Quality
Summary: This is a high-quality, accurate, and fluent translation that faithfully preserves the technical and mathematical content of the original document. Terminology is consistent with the provided glossary, and all MyST/Markdown formatting, code blocks, and math expressions are intact. Only minor stylistic nitpicks were found, none of which affect comprehension or technical accuracy. Excellent handling of complex mathematical definitions and theorem statements (e.g., Kesten--Goldie theorem conditions) with precise and consistent terminology Code blocks, LaTeX equations, and MyST directives are all preserved perfectly with no syntax errors Natural and fluent rendering of economic/statistical concepts such as '横截面解释', '重尾', '平稳分布' consistent with the glossary Good handling of the translation metadata block with appropriate heading mappings Suggestions:
🔍 Diff Quality
Summary: The resynced target correctly mirrors the current English source's structure, section order, code cells, and prose, and adds a properly formed translation.headings map covering all headings including nested subsections. Issues:
This review was generated automatically by action-translation review mode. |
Forward Resync: kesten_processes.md
Source: QuantEcon/lecture-python.myst — lectures/kesten_processes.md
Source commit:
13d27c4This PR resyncs the translation to match the current source document.
Reason: The target uses older code (numpy random, numba/jit instead of JAX for kp_ex4 solution, and uses np.random instead of rng-based generation for kesten_ts and garch_ts), which differs substantively from the source's JAX-based implementation and rng.default_rng approach. Also the source's code cells use jax.NamedTuple-based Firm struct and lax.scan/vmap, entirely absent in target which uses numba parallel loops instead. These are substantive implementation differences, not just style. No target-only additions of substance were found beyond i18n font setup, which doesn't count. Overall this reflects an outdated/different translation of the technical content requiring re-translation to match current source.
Changes
Whole-file resync applied. The entire document was resynced in a single pass.
Created by action-translation forward resync