Skip to content

[action-translation] resync: kesten_processes.md#190

Merged
mmcky merged 1 commit into
mainfrom
resync/kesten_processes
Jul 22, 2026
Merged

[action-translation] resync: kesten_processes.md#190
mmcky merged 1 commit into
mainfrom
resync/kesten_processes

Conversation

@mmcky

@mmcky mmcky commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Forward Resync: kesten_processes.md

Source: QuantEcon/lecture-python.mystlectures/kesten_processes.md
Source commit: 13d27c4
This 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

Copilot AI review requested due to automatic review settings July 21, 2026 23:24
@mmcky mmcky added action-translation-sync CLI resync PR (translate forward --github) resync Forward resync labels Jul 21, 2026
@netlify

netlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Deploy Preview for astonishing-narwhal-a8fc64 ready!

Name Link
🔨 Latest commit bd957ec
🔍 Latest deploy log https://app.netlify.com/projects/astonishing-narwhal-a8fc64/deploys/6a5fffa4eab5c90008890cab
😎 Deploy Preview https://deploy-preview-190--astonishing-narwhal-a8fc64.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, consolidated pip 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.

Comment on lines +74 to +78
```{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
Comment on lines +442 to 446
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$")
Comment on lines +654 to +659
"在给定一个新的随机密钥的情况下,更新单个企业的规模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)
Comment on lines +665 to +676
@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`个企业。
@github-actions

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request July 21, 2026 23:30 Inactive
@mmcky mmcky added the action-translation PRs created by QuantEcon/action-translation label Jul 21, 2026
@github-actions

Copy link
Copy Markdown

✅ Translation Quality Review

Verdict: PASS | Model: claude-sonnet-5 | Date: 2026-07-21


📝 Translation Quality

Criterion Score
Accuracy 9/10
Fluency 9/10
Terminology 9/10
Formatting 10/10
Overall 9.2/10

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:

  • Overview section: '主要有两个原因' slightly overtranslates 'for at least two reasons' (which implies possibly more than two) → consider '至少有两个原因' to preserve the nuance
  • kp_ex2 solution: '相比小企业,Gibrat定律通常被发现对于大企业而言是一个合理的近似' is a bit awkward phrasing; consider '相较于小企业,Gibrat定律通常被认为更适用于大企业' for smoother flow
  • Stationarity section: 'F^*(y) = \int ... \quad \text{对所有 } y \geq 0 \text{成立 }' has inconsistent spacing around 'text{成立}' (missing space before '成立') - minor LaTeX text spacing issue but should be '\text{ 成立}' or restructure for consistency with source's '\text{for all } y \geq 0'

🔍 Diff Quality

Check Status
Scope Correct
Position Correct
Structure Preserved
Heading-map Correct
Overall 10/10

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:

  • The 'Application: firm dynamics::Heavy tails' heading maps to '重尾' which duplicates the top-level 'Heavy tails': '重尾' entry, but since the English source uses '### Heavy tails' as a subsection under two different parent sections with the same English text, this is expected/unavoidable given the source structure, not an error.
  • Frontmatter dropped 'jupytext_version' and 'kernelspec.display_name' details differences (e.g. 'Python 3 (ipykernel)' vs 'Python 3') were already present pre-resync and are not part of this change, so not penalized.

This review was generated automatically by action-translation review mode.

@mmcky
mmcky merged commit da7b176 into main Jul 22, 2026
11 checks passed
@mmcky
mmcky deleted the resync/kesten_processes branch July 22, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action-translation PRs created by QuantEcon/action-translation action-translation-sync CLI resync PR (translate forward --github) resync Forward resync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants