Skip to content

🌐 [translation-sync] [uncertainty_traps.md] Update np.random → Generator API - #214

Open
mmcky wants to merge 2 commits into
mainfrom
translation-sync-2026-07-31T23-19-03-pr-1011
Open

🌐 [translation-sync] [uncertainty_traps.md] Update np.random → Generator API#214
mmcky wants to merge 2 commits into
mainfrom
translation-sync-2026-07-31T23-19-03-pr-1011

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

#1011 - [uncertainty_traps.md] Update np.random → Generator API

Files Updated

  • ✏️ lectures/uncertainty_traps.md
  • ✏️ .translate/state/uncertainty_traps.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:19
@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 e70059b
🔍 Latest deploy log https://app.netlify.com/projects/astonishing-narwhal-a8fc64/deploys/6a6d2d6ed870960009ec2dc3
😎 Deploy Preview https://deploy-preview-214--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: WARN | Model: claude-sonnet-5 | Date: 2026-07-31
Routing: editor — verdict WARN (auto-merge requires PASS); 2 minor finding(s) in gating categories (accuracy/terminology/syntax/diff-check/other); accuracy 8 below floor 9; terminology 8 below floor 9; formatting 6 below floor 8


📝 Translation Quality

Criterion Score
Accuracy 8/10
Fluency 8/10
Terminology 8/10
Formatting 6/10
Overall 7.7/10

Summary: The translation of the Implementation and Exercises sections is accurate and technically sound, preserving equations, code, and structure well. Minor issues include an unexplained code-cell language tag change (python3 → ipython3), added matplotlib font-configuration lines not in the source, a slightly disjointed sentence in the ex1 solution, and small formatting quirks (stray blank lines) that don't break rendering but deviate from the source's clean formatting. Core technical content and equations in the Implementation and Exercises sections are accurately translated with correct mathematical notation preserved. Code blocks (aside from one label change) are faithfully reproduced with properly translated comments. Terminology such as '卡尔曼滤波', '精确度', '稳态' is used consistently and matches the glossary.

Suggestions:

  • [minor · formatting] lectures/uncertainty_traps.md — ## Implementation code block: The original code cell used python3 as the language identifier ({code-cell} python3), but the translation changed it to ipython3 for the UncertaintyTrapEcon class definition, introducing an inconsistency with other code cells in the same document (which remain python3) and with the source. → Use ```{code-cell} python3 to match the source and other code blocks in the document.
  • [minor · accuracy] lectures/uncertainty_traps.md — ## Implementation, imports code block: The translation adds extra lines (matplotlib font configuration: FONTPATH, font_manager, rcParams for font family and figure size) that do not exist in the English source's import block. This is additional content not present in the original. → Remove the added font-configuration lines to match the source exactly, or if intentional for CJK rendering, keep them but note this deviates from a literal translation.
  • [minor · fluency] lectures/uncertainty_traps.md — solution uncertainty_traps_ex1: Awkward sentence break: '本练习要求你根据所述内容验证讲座中给出的$\gamma$和$\mu$的运动规律' is followed by a stray blank-line-separated fragment '关于标量高斯设置中贝叶斯更新的结果。' which reads as disconnected from the preceding sentence, unlike the fluent single-sentence flow of the English source. → Merge into one sentence: '本练习要求你根据关于标量高斯设置中贝叶斯更新的所述结果,验证讲座中给出的 $\gamma$$\mu$ 的运动规律。'
  • [nit · formatting] lectures/uncertainty_traps.md — solution-start uncertainty_traps_ex2, gamma formula: An unnecessary blank line is inserted inside the math block right after \left(, breaking the LaTeX block awkwardly (though it still renders correctly since $$ delimiters are matched). → Remove the stray blank line inside the display math block for consistency with the source formatting.
  • [nit · fluency] lectures/uncertainty_traps.md — ## 实现: Missing space before '{doc}' style spacing rule is respected elsewhere, but minor extra blank line appears between two bullet points under 'Implementation' section list (between the first and second bullet), which is a formatting inconsistency though not a syntax error. → Remove the extra blank line between the two bullet items for consistent list formatting.

🔍 Diff Quality

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

Summary: The target document's code cells were not updated to reflect the source's RNG refactor (adding rng parameter and using np.random.default_rng()), despite the file being reported as modified.

Issues:

  • The gen_aggregates method signature was not updated to accept 'rng' parameter in the target document
  • np.random.randn calls inside gen_aggregates were not replaced with rng.standard_normal
  • The 'rng = np.random.default_rng()' initialization line was not added before w_shocks generation
  • w_shocks = np.random.randn(sim_length) was not changed to rng.standard_normal(sim_length)
  • Calls to econ.gen_aggregates() were not updated to econ.gen_aggregates(rng) (two call sites)
  • The target 'After' document is textually identical to the target 'Before' document in the code cells, meaning the source's RNG refactor was not synced despite the reported +11/-11 diff

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 uncertainty_traps.md to match upstream changes that migrate random number generation from legacy np.random.* calls to NumPy’s Generator API.

Changes:

  • Updated UncertaintyTrapEcon.gen_aggregates to accept an RNG (rng) and use rng.standard_normal(...) for draws.
  • Updated the simulation code to create a rng = np.random.default_rng() and route all stochastic draws through it.
  • Refreshed translation sync state metadata (.translate/state/uncertainty_traps.md.yml) to the new source SHA/date/model/tool version.

Reviewed changes

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

File Description
lectures/uncertainty_traps.md Switches randomness in the lecture’s model and simulation to NumPy’s Generator API and threads an RNG through the relevant calls.
.translate/state/uncertainty_traps.md.yml Updates translation-sync bookkeeping (source SHA, sync date, model, tool version).

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

@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:02 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