Skip to content

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

Merged
mmcky merged 3 commits into
mainfrom
translation-sync-2026-08-05T04-56-47-pr-624
Aug 19, 2026
Merged

🌐 [translation-sync] [mccall_q] Fix typos, heading case and figure legend#236
mmcky merged 3 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 f8c4415
🔍 Latest deploy log https://app.netlify.com/projects/astonishing-narwhal-a8fc64/deploys/6a851636ce77810008ed799a
😎 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-19
Routing: editor — 3 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, accurate translation of a technically dense lecture on Q-learning applied to the McCall search model. Mathematical content, code, and structure are faithfully preserved, and terminology is mostly consistent with the glossary. Minor issues include a few additions of explanatory content beyond the source and a small terminology overlap between 'gain parameter' and 'learning rate' that could be clarified. No syntax errors were found in the changed sections. Mathematical notation and equation numbering are fully preserved and correctly matched to source Code blocks remain functionally intact with helpful added Chinese comments where appropriate (e.g., docstring translations) Technical concepts like Q-function, temporal difference learning, and epsilon-greedy strategy are translated clearly and consistently with appropriate glossary usage

Suggestions:

  • [minor · terminology] lectures/mccall_q.md — Q-learning section, 'the adaptive learning scheme': The English term 'gain parameter' is translated as '学习率' (learning rate), which conflates it with the separate 'lr' / learning rate α used later in the Q-learning recursion. The original text uses distinct terms 'gain' (α in eq:old106, informal argument) versus later formal 'learning rate' for the Q-table update; using '学习率' for both may blur the distinction the text intends, though both do repre… → Consider using '增益参数' for the informal 'gain parameter' in this transitional section to preserve the distinction from '学习率' used in the formal Q-learning algorithm.
  • [minor · fluency] lectures/mccall_q.md — Overview, '在本讲中,我们将Q学习算法应用到McCall求职模型中,探讨劳动者如何通过这种方法做出最优决策。': This sentence adds explanatory content ('探讨劳动者如何通过这种方法做出最优决策') not present in the English source sentence 'This lecture applies a Q-learning algorithm to the situation faced by a McCall worker.' While not inaccurate, it is an addition beyond the source text. → 本讲将Q学习算法应用于McCall劳动者所面临的情形。
  • [minor · terminology] lectures/mccall_q.md — Q-learning section, 'The terms $\widetilde{TD}(w,a)$ ... are the temporal difference errors': Translation renders 'temporal difference errors' with an inserted parenthetical '(TD error)' that is acceptable, but elsewhere 'TD' abbreviation usage is inconsistent (sometimes spelled out, sometimes left as TD). This is a minor consistency issue rather than an error. → Keep consistent use of '时序差分误差(TD误差)' throughout for clarity.

🔍 Diff Quality

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

Summary: The heading metadata and prose changes were correctly synced, but several source code-cell modifications (progress-print logic, cell splitting, legend formatting) were not applied to the target document.

Issues:

  • Code cell changes from source (run_epochs and plot_epochs progress-print logic using max(1, N//10)) were not applied in target; target retains old n%(N/10)==0 logic
  • Source split the n=30 code cell into two separate cells (VFI computation moved to its own cell); target still has the original single combined cell with '# VFI' comment
  • Legend formatting change (bbox_to_anchor with multi-column layout and error:.2f formatting) in plot_epochs was not mirrored in target code
  • Code cells are typically expected to stay synchronized 1:1 with source since they are language-agnostic; several functional/formatting code changes were missed

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
…lict by keeping the branch's newer source state (46cf999, 2026-08-05, post-dates #229's 4a5fad7)
@github-actions
github-actions Bot temporarily deployed to pull request August 19, 2026 03:44 Inactive
@mmcky
mmcky merged commit e4c3980 into main Aug 19, 2026
7 checks passed
@mmcky
mmcky deleted the translation-sync-2026-08-05T04-56-47-pr-624 branch August 19, 2026 03:56
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