Skip to content

🌐 [translation-sync] [likelihood_ratio_process_2.md] Update np.random → Generator API - #227

Open
mmcky wants to merge 2 commits into
mainfrom
translation-sync-2026-07-31T23-24-39-pr-991
Open

🌐 [translation-sync] [likelihood_ratio_process_2.md] Update np.random → Generator API#227
mmcky wants to merge 2 commits into
mainfrom
translation-sync-2026-07-31T23-24-39-pr-991

Conversation

@mmcky

@mmcky mmcky commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Automated Translation Sync

This PR contains automated translations from QuantEcon/lecture-python.myst.

Source PR

#991 - [likelihood_ratio_process_2.md] Update np.random → Generator API

Files Updated

  • ✏️ lectures/likelihood_ratio_process_2.md
  • ✏️ .translate/state/likelihood_ratio_process_2.md.yml

Details

  • Source Language: en
  • Target Language: zh-cn
  • Model: claude-sonnet-5

This PR was created automatically by the translation action.

Copilot AI review requested due to automatic review settings July 31, 2026 23:24
@mmcky mmcky added action-translation PRs created by QuantEcon/action-translation automated Automated sync PR opened by action-translation labels Jul 31, 2026
@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for astonishing-narwhal-a8fc64 ready!

Name Link
🔨 Latest commit e5924ae
🔍 Latest deploy log https://app.netlify.com/projects/astonishing-narwhal-a8fc64/deploys/6a6d2ebcf2904b00088d5429
😎 Deploy Preview https://deploy-preview-227--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.

@github-actions

Copy link
Copy Markdown

✅ Translation Quality Review

Verdict: PASS | Model: claude-sonnet-5 | Date: 2026-07-31
Routing: editor — 1 minor finding(s) in gating categories (accuracy/terminology/syntax/diff-check/other)


📝 Translation Quality

Criterion Score
Accuracy 9/10
Fluency 8/10
Terminology 9/10
Formatting 8/10
Overall 8.6/10

Summary: 翻译整体质量较高,准确传达了原文的经济学和数学概念,专业术语翻译规范。主要问题集中在模拟部分的代码注释和图表标签中存在中英文混杂及'agent'翻译不一致(个体/代理)的现象,属于风格统一性问题而非准确性错误。未发现严重的语法错误或数学公式损坏。 数学公式和代码块完整保留,未出现语法错误 专业术语(如似然比、贝叶斯更新、帕累托权重等)翻译准确,符合术语表 长句结构处理得当,保持了学术文本的严谨性和可读性 标题翻译与YAML frontmatter中的映射保持一致

Suggestions:

  • [minor · formatting] lectures/likelihood_ratio_process_2.md — Simulations section, plotting code comments: 在'模拟'部分的代码注释和图例标签中,部分内容被翻译(如'中位数'、'时间'、'代理1的份额'),但同一图表中的其他标签(如'Nature = f'等标题、'Density'、'Overlap')未翻译,导致中英文混杂,风格不统一。 → 统一翻译或统一保留英文原文,例如将'Nature = f'等标题也翻译为'自然 = f',并翻译'Density'为'密度'、'Overlap'为'重叠区域'。
  • [minor · terminology] lectures/likelihood_ratio_process_2.md — Simulations section, code block plotting agent labels: 术语不一致:正文中'agent'统一译为'个体'(如'个体1'、'个体2'),但在部分代码注释和图例标签中译为'代理'(如'代理1的份额'、'代理1消费份额'),造成术语不统一。 → 统一将'agent'译为'个体',或在整篇文档中统一使用'代理',避免混用。
  • [minor · formatting] lectures/likelihood_ratio_process_2.md — Overview section code import block: 翻译文档在导入代码块中添加了英文源文档中没有的字体设置代码(FONTPATH、mpl.font_manager等),这虽然是为了支持中文字体渲染而添加的合理修改,但与英文源文档存在结构性差异,建议在评估中确认这是否属于翻译系统的既定惯例。 → 如果这是标准翻译流程的一部分,则无需更改;否则应说明添加原因。
  • [nit · fluency] lectures/likelihood_ratio_process_2.md — 在如下不等式的证明中来自 lr_ex4 exercise, '概率模型'段落: 部分长句的翻译稍显生硬,例如'我们想要推导分配$c^i(s^t), i = 1,2$,并观察当以下情况发生时会发生什么',读起来略显直译腔调,可以更符合中文表达习惯。 → 可改为'我们想要推导出分配 $c^i(s^t), i = 1,2$,并观察在以下情况下会发生什么'。

🔍 Diff Quality

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

Summary: The RNG refactoring (adding np.random.default_rng() and replacing np.random.beta/rand calls with rng.beta/rng.random) was correctly and completely mirrored in all corresponding code cells of the Chinese translation.


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

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 automated translation-sync PR updates the Chinese lecture likelihood_ratio_process_2.md to use NumPy’s Generator API (np.random.default_rng() + rng.*) instead of the legacy np.random.* functions, keeping the zh-cn content aligned with upstream changes.

Changes:

  • Introduces rng = np.random.default_rng() and replaces np.random.beta/rand calls with rng.beta/random.
  • Updates a simulation helper to draw randomness via the passed generator.
  • Updates translation-sync state metadata (source-sha, sync date, mode, tool version).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lectures/likelihood_ratio_process_2.md Switches lecture randomness from np.random.* to Generator (rng.*) across code cells.
.translate/state/likelihood_ratio_process_2.md.yml Updates translation sync tracking metadata to the new source commit and tool version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 156 to +167
@@ -162,7 +164,7 @@ def simulate(a, b, T=50, N=500):

for i in range(N):
for j in range(T):
w = np.random.beta(a, b)
w = rng.beta(a, b)
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request August 1, 2026 00:00 Inactive
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 automated Automated sync PR opened by action-translation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants