🌐 [translation-sync] [uncertainty_traps.md] Update np.random → Generator API - #214
🌐 [translation-sync] [uncertainty_traps.md] Update np.random → Generator API#214mmcky wants to merge 2 commits into
Conversation
✅ Deploy Preview for astonishing-narwhal-a8fc64 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
| 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
python3as the language identifier ({code-cell} python3), but the translation changed it toipython3for the UncertaintyTrapEcon class definition, introducing an inconsistency with other code cells in the same document (which remainpython3) 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.
There was a problem hiding this comment.
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_aggregatesto accept an RNG (rng) and userng.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.
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.ymlDetails
This PR was created automatically by the translation action.