Skip to content

🌐 [translation-sync] [mccall_q] Fix typos, heading case and figure legend - #236

Open
mmcky wants to merge 2 commits into
mainfrom
translation-sync-2026-08-05T04-56-47-pr-624
Open

🌐 [translation-sync] [mccall_q] Fix typos, heading case and figure legend#236
mmcky wants to merge 2 commits into
mainfrom
translation-sync-2026-08-05T04-56-47-pr-624

Conversation

@mmcky

@mmcky mmcky commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Automated Translation Sync

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

Source PR

#624 - [mccall_q] Fix typos, heading case and figure legend

Files Updated

  • ✏️ lectures/mccall_q.md
  • ✏️ .translate/state/mccall_q.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 lite review requested due to automatic review settings August 5, 2026 04:56
@mmcky mmcky added action-translation PRs created by QuantEcon/action-translation automated Automated sync PR opened by action-translation review labels Aug 5, 2026
@netlify

netlify Bot commented Aug 5, 2026

Copy link
Copy Markdown

Deploy Preview for astonishing-narwhal-a8fc64 ready!

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

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

✅ Translation Quality Review

Verdict: PASS | Model: claude-sonnet-5 | Date: 2026-08-05
Routing: editor — 2 minor finding(s) in gating categories (accuracy/terminology/syntax/diff-check/other); terminology 8 below floor 9
Shadow gate: would NOT auto-merge (recorded only; no action taken)


📝 Translation Quality

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

Summary: This is a high-quality, faithful translation of a technically dense lecture on Q-learning applied to the McCall search model. Terminology is handled consistently and accurately, mathematical content is fully preserved, and the prose reads naturally in academic Simplified Chinese. Minor issues include a slight expansion in the Overview section and a small terminological nuance around 'gain' vs. '学习率', but these do not affect overall comprehension or correctness. Mathematical notation, equations, and code blocks are fully preserved without corruption across all changed sections Technical terms such as 时序差分学习, 贝尔曼方程, Q-表/Q-函数, ε-贪婪算法 are translated consistently and correctly throughout The translation maintains appropriate academic register and closely follows the logical structure of the original argument, including the pseudocode steps for Q-learning

Suggestions:

  • [minor · accuracy] lectures/mccall_q.md — ## Overview, '在本讲中,我们将Q学习算法应用到McCall求职模型中,探讨劳动者如何通过这种方法做出最优决策。': The English source simply states the lecture applies Q-learning to the McCall worker's situation; the Chinese adds an unsupported elaboration ('探讨劳动者如何通过这种方法做出最优决策') not present in the source, slightly expanding beyond the original meaning. → 本讲将 Q-学习算法应用于 McCall 劳动者所面临的情境。
  • [minor · terminology] lectures/mccall_q.md — ## Q-learning, '其中 $\alpha \in (0,1)$ 是一个小的学习率参数': The English source calls α a 'gain' parameter, but the translation renders it as '学习率' (learning rate), which is a different, more specific term already used elsewhere for 'lr'/α in later code comments ('学习率α'). While closely related, this creates a slight terminological inconsistency since 'gain' and 'learning rate' are technically distinct concepts in the TD-learning literature, though used int… → Consider using '增益' (gain) to match the source term more precisely, or keep consistent with subsequent uses of '学习率'.
  • [minor · fluency] lectures/mccall_q.md — ## From probabilities to samples, '为了开始思考Q-learning,我们可以尝试一个不严谨但有启发性的方法:移除积分符号。': The English text describes erasing the integral sign as setting the stage for an 'illegitimate argument' (i.e., a formally invalid but heuristically useful move). The translation softens this to '不严谨但有启发性的方法' which is reasonable, but slightly loses the more pointed characterization of the argument as illegitimate/informal in the original. → 为了引出一个不严谨(illegitimate)但可以启发我们思考Q学习的论证,我们可以移除积分符号。
  • [nit · terminology] lectures/mccall_q.md — ## Q-learning, '## Q-学习' heading translation: The glossary specifies 'Q-learning' should map to 'Q-学习' per the frontmatter translation heading mapping, which is followed consistently; this is just a confirmation note, not an issue.

🔍 Diff Quality

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

Summary: The translation sync correctly applied all heading capitalization changes, code refactoring (rng threading, cell merge, formatting fixes), and text corrections in the same relative positions as the source.


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 PR syncs zh-cn lecture content for mccall_q from the upstream English source PR, primarily correcting headings/wording and updating some embedded code cells used in the lecture.

Changes:

  • Updated the front-matter translation.headings keys to match the source heading case.
  • Adjusted several code cells (randomness handling, progress printing, plotting legend formatting) and refined one explanatory sentence.
  • Updated translation-sync state metadata (source-sha, synced-at, mode/tool-version).

Reviewed changes

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

File Description
lectures/mccall_q.md Translation heading key case updates; text tweak; code-cell changes to RNG usage and plotting/progress output.
.translate/state/mccall_q.md.yml Updates sync metadata (source SHA/date/mode/tool version).
Suppressed comments (5)

lectures/mccall_q.md:514

  • temp_diff is part of a Numba @jitclass; the rng parameter (NumPy Generator) is not Numba-compatible and will break compilation. Remove the rng argument and rely on np.random.* calls inside jitted code.
    def temp_diff(self, qtable, state, accept, rng):
        """
        计算与状态和动作相关的TD。
        """

lectures/mccall_q.md:533

  • run_one_epoch is a Numba @jitclass method; taking a NumPy Generator parameter (rng) is not supported by Numba and will fail compilation. Drop the rng parameter and call draw_offer_index() directly.
    def run_one_epoch(self, qtable, rng, max_times=20000):
        """
        运行一个"轮次"。
        """

lectures/mccall_q.md:547

  • Within a Numba @jitclass, calls to rng.random() and passing rng into temp_diff are not supported (NumPy Generator is not a Numba type). Use np.random.random() and call temp_diff(...) without a rng argument.
            # 选择动作
            accept = np.argmax(qtable[s, :])
            if rng.random()<=eps:
                accept = 1 - accept

lectures/mccall_q.md:573

  • run_epochs is decorated with @jit and calls into a Numba @jitclass. Accepting/passing a NumPy Generator (rng) will force object-mode at best and can still fail depending on compilation. Remove the rng parameter and call run_one_epoch without it.
@jit
def run_epochs(N, qlmc, qtable, rng):
    """
    运行N次轮次,每次使用上一次迭代的qtable。
    """

lectures/mccall_q.md:670

  • After removing rng from run_one_epoch, this call should not pass rng (otherwise it will raise a TypeError).
        new_qtable = qlmc_new.run_one_epoch(qtable, rng)

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

Comment thread lectures/mccall_q.md
plt.rcParams['font.family'] = ['Source Han Serif SC']

np.random.seed(123)
rng = np.random.default_rng(123)
Comment thread lectures/mccall_q.md
Comment on lines +502 to 506
def draw_offer_index(self, rng):
"""
从工资分布中抽取状态索引。
"""

Comment thread lectures/mccall_q.md
# 运行
qtable0 = np.zeros((len(w_default), 2))
qtable = run_epochs(20000, qlmc, qtable0)
qtable = run_epochs(20000, qlmc, qtable0, rng)
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request August 5, 2026 05:05 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 review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants