🌐 [translation-sync] [perm_income.md] Update np.random → Generator API#199
Conversation
✅ Deploy Preview for astonishing-narwhal-a8fc64 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Translation Quality ReviewVerdict: PASS | Model: claude-sonnet-5 | Date: 2026-07-23 📝 Translation Quality
Summary: The translation of the 'A Simple Example with IID Income' section is accurate, fluent, and terminologically consistent with the glossary. Mathematical content and code blocks are faithfully preserved. Only minor stylistic nitpicks exist (e.g., slightly literal phrasing of 'realization'), and no blocking or major issues were found in this section. The mathematical notation and equations in the 'A Simple Example with IID Income' section are preserved accurately and completely. Technical terms such as '独立同分布', '高斯随机游走', and '非金融收入' are correctly and consistently translated per the glossary. The explanatory prose flows naturally in Chinese and faithfully conveys the logical structure of the original explanation about IID income, debt, and consumption dynamics. Suggestions:
🔍 Diff Quality
Summary: The translation metadata and prose are correctly preserved, but the actual source code changes (rng refactoring) were not applied to the target document's code cells, despite the file being flagged as modified. Issues:
This review was generated automatically by action-translation review mode. |
There was a problem hiding this comment.
Pull request overview
Syncs the zh-cn translation of perm_income.md with upstream changes that modernize random number generation to NumPy’s Generator API, keeping the lecture content aligned with the source repository and current NumPy usage.
Changes:
- Update the lecture code cells to use
np.random.default_rng()andrng.standard_normal(...)instead of legacynp.random.randn(...). - Thread the RNG object into
time_path(...)calls so random draws come from theGenerator. - Update translation sync state metadata (source SHA, sync date, model, tool version, mode).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lectures/perm_income.md | Switches example simulations from legacy np.random calls to the Generator API. |
| .translate/state/perm_income.md.yml | Updates translation sync metadata to reflect the new upstream source commit and tooling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Reviewer note: the three
|
| Source change | Present here |
|---|---|
def time_path(T) → def time_path(T, rng) |
✅ |
np.random.randn(T+1) → rng.standard_normal(T+1) |
✅ |
added rng = np.random.default_rng() |
✅ |
both call sites → time_path(T, rng) |
✅ |
Nothing is missing, and the frontmatter state update (source-sha, synced-at, mode: UPDATE, tool-version: 0.22.0) is correct too.
The reviewer was not short of information — it is passed both the before and after of the source and the target, untruncated and with code intact, and the before/after are fetched from the base and head SHAs respectively. It was shown the change and reported its absence. Filed as QuantEcon/action-translation#148, with the note that positionCorrect is specified in prose terms ("do changes appear in the same sections as source") while this diff is entirely code, which may make code-only syncs a systematic weak spot.
What still deserves a human eye, since the structural findings being wrong does not make the review worthless:
- the
formattingfinding about the code-cell language tag (python3vsipython3) is a real observation about this file, though it predates this PR; - the
fluencyfindings are ordinary translation-quality suggestions, worth the usual judgement.
For context: this is the second organic sync PR since translation automation was turned on for this repo (QuantEcon/lecture-python.myst#979, merged today). The first, #198, was routed to editor for a genuinely correct reason — a glossary violation. Both are the first real production data for QuantEcon/action-translation#147.
Automated Translation Sync
This PR contains automated translations from QuantEcon/lecture-python.myst.
Source PR
#975 - [perm_income.md] Update np.random → Generator API
Files Updated
lectures/perm_income.md.translate/state/perm_income.md.ymlDetails
This PR was created automatically by the translation action.