Skip to content

🌐 [translation-sync] [samuelson.md] Update np.random → Generator API - #221

Merged
mmcky merged 2 commits into
mainfrom
translation-sync-2026-07-31T23-21-07-pr-1002
Aug 18, 2026
Merged

🌐 [translation-sync] [samuelson.md] Update np.random → Generator API#221
mmcky merged 2 commits into
mainfrom
translation-sync-2026-07-31T23-21-07-pr-1002

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

#1002 - [samuelson.md] Update np.random → Generator API

Files Updated

  • ✏️ lectures/samuelson.md
  • ✏️ .translate/state/samuelson.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:21
@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 95d2983
🔍 Latest deploy log https://app.netlify.com/projects/astonishing-narwhal-a8fc64/deploys/6a6d2de8d7e2180008ea6217
😎 Deploy Preview https://deploy-preview-221--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: auto-merge — no gating findings; floors met


📝 Translation Quality

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

Summary: 本次PR修改部分的翻译质量很高,术语使用准确一致,代码注释和打印输出的中文本地化处理得当,公式与格式完整保留,未发现语法错误。仅有个别代码注释翻译(如“Shock variance”译为“随机项”)可以更精确,但不影响整体理解和质量。 对特征多项式、根的分类、稳定性等专业术语翻译准确一致,符合术语表规范 代码块、LaTeX公式、MyST指令等格式在修改部分均完整保留,未破坏文档结构 长句和技术性描述(如关于LinearStateSpace类映射Samuelson模型的段落)翻译流畅,符合学术语域

Suggestions:

  • [minor · formatting] lectures/samuelson.md — ### Function to describe implications of characteristic polynomial: 在 categorize_solutionanalyze_roots 函数的文档字符串及打印输出中,英文原文使用英文引号/术语(如 'Explosive oscillations'),译文中文字符串(如"爆炸性振荡")与英文源码字符串不完全对应,但这是函数返回值翻译的必要调整,属于合理的本地化,不构成实质问题。
  • [nit · fluency] lectures/samuelson.md — ## Using the LinearStateSpace class: "随机项"用于翻译代码注释 "Shock variance",实际含义是“冲击方差”而非泛泛的“随机项”,翻译略有简化但不影响理解。 → 可考虑译为"冲击方差"以更贴近原文含义
  • [nit · fluency] lectures/samuelson.md — ### Inheriting methods from LinearStateSpace: 代码注释 "Shock variance" 同样被译为"随机项",与上文一致但可以更精确地译为"冲击方差"。 → 可统一改为"冲击方差"

🔍 Diff Quality

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

Summary: All four code changes (np.random.seed to default_rng refactoring in three locations) are correctly synced in matching positions with structure and heading-map preserved, aside from a minor kernelspec display_name inconsistency.

Issues:

  • Target kernelspec display_name remains 'Python 3' instead of being updated to 'Python 3 (ipykernel)' as in the source, though format_version/jupytext_version were updated

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 samuelson lecture to match upstream changes that migrate examples from legacy np.random global state usage to NumPy’s Generator API, improving reproducibility and avoiding side effects from np.random.seed.

Changes:

  • Added Jupytext metadata (format_version, jupytext_version) and updated the kernel display name in lectures/samuelson.md.
  • Replaced np.random.seed + np.random.normal with np.random.default_rng(...).normal(...) in the lecture’s simulation code.
  • Updated LinearStateSpace.simulate(...) calls to pass an explicit random_state RNG.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lectures/samuelson.md Updates RNG usage to Generator and threads RNG into simulate(...) calls; updates notebook metadata.
.translate/state/samuelson.md.yml Bumps translation-sync state (source SHA, sync date, mode, tool version).

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

@github-actions

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request July 31, 2026 23:57 Inactive
@mmcky
mmcky merged commit 405735d into main Aug 18, 2026
10 of 12 checks passed
@mmcky
mmcky deleted the translation-sync-2026-07-31T23-21-07-pr-1002 branch August 18, 2026 23:26
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