Skip to content

🌐 [translation-sync] [imp_sample] Convert code to JAX and check stylesheet compliance - #232

Open
mmcky wants to merge 2 commits into
mainfrom
translation-sync-2026-08-02T20-35-32-pr-620
Open

🌐 [translation-sync] [imp_sample] Convert code to JAX and check stylesheet compliance#232
mmcky wants to merge 2 commits into
mainfrom
translation-sync-2026-08-02T20-35-32-pr-620

Conversation

@mmcky

@mmcky mmcky commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Automated Translation Sync

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

Source PR

#620 - [imp_sample] Convert code to JAX and check stylesheet compliance

Files Updated

  • ✏️ lectures/imp_sample.md
  • ✏️ .translate/state/imp_sample.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 August 2, 2026 20:35
@mmcky mmcky added action-translation PRs created by QuantEcon/action-translation automated Automated sync PR opened by action-translation jax-conversion review labels Aug 2, 2026
@netlify

netlify Bot commented Aug 2, 2026

Copy link
Copy Markdown

Deploy Preview for astonishing-narwhal-a8fc64 ready!

Name Link
🔨 Latest commit 025131c
🔍 Latest deploy log https://app.netlify.com/projects/astonishing-narwhal-a8fc64/deploys/6a6faa187c5b5800080542a6
😎 Deploy Preview https://deploy-preview-232--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 2, 2026

Copy link
Copy Markdown

✅ Translation Quality Review

Verdict: PASS | Model: claude-sonnet-5 | Date: 2026-08-02
Routing: editor — 1 minor finding(s) in gating categories (accuracy/terminology/syntax/diff-check/other)


📝 Translation Quality

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

Summary: This is a high-quality, accurate translation of a technically dense lecture on importance sampling. The mathematical content, statistical reasoning, and code comments are rendered faithfully and fluently, with correct MyST/Markdown syntax throughout. Minor issues include a slight inconsistency in translating 'importance sampling' (重要性采样 vs 重要性抽样) and an unexplained addition of font-setup code not in the source, neither of which affects comprehension or correctness significantly. Mathematical notation and LaTeX expressions are preserved accurately throughout all changed sections Technical explanations of importance sampling, variance divergence, and Monte Carlo failure are translated with precision and clarity, preserving nuanced statistical arguments Proper full-width Chinese punctuation and correct spacing around inline MyST directives (e.g., {doc}, {numref}) are consistently applied

Suggestions:

  • [minor · formatting] lectures/imp_sample.md — Overview section, Python imports code cell: The translation's code cell adds extra lines (FONTPATH, mpl.font_manager, plt.rcParams) not present in the English source's import block. While this appears to be a standard font-setup addition used across translated lectures, it is a deviation from the source content within a code cell, which should ideally mirror the original exactly except for comments. → Confirm this font-loading addition is part of the standard translation build pipeline convention; if not required, remove it to match the source exactly.
  • [minor · terminology] lectures/imp_sample.md — ## 重要性采样 (heading) vs ## 选择抽样分布 / 重要性抽样 elsewhere: The translation inconsistently renders 'importance sampling' as both '重要性采样' (heading) and '重要性抽样' (used throughout body text and other headings). While both are acceptable renderings, mixing them within the same document reduces terminological consistency. → Standardize on one term throughout, e.g., '重要性抽样', including the '## 重要性采样' heading, to match the more frequently used term elsewhere in the document.
  • [nit · fluency] lectures/imp_sample.md — Distribution of sample mean, plot_estimates call captions: In the h2/h3 estimate plots, the imp_label argument is translated to '$h_2$ 生成' and '$h_3$ 生成' while the earlier corresponding call for h1 keeps '$h$ generating' untranslated (appears as English string literal passed to legend, not prose, so likely fine) — flagging only for consistency awareness since h2/h3 labels were translated but h1's was not. → For consistency, consider translating all imp_label string arguments uniformly (e.g., '$h$ 生成') if these are meant to appear in rendered plot legends.

🔍 Diff Quality

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

Summary: The translation sync correctly applies all structural, code, and content changes from the source in matching positions with preserved heading structure and valid heading-map, aside from minor untranslated string inconsistencies.

Issues:

  • Two figure captions were left untranslated in English ('Monte Carlo and importance sampling estimates' for fig-imp-estimates), while other analogous captions (fig-imp-estimates-h2, fig-imp-estimates-h3) were translated to Chinese - minor inconsistency
  • Legend labels '$g$ generating' remain untranslated in plot_estimates calls while imp_label arguments were translated (e.g., '$h_2$ 生成', '$h_3$ 生成') - inconsistent translation of similar UI strings

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 translation-sync PR updates the Chinese lecture imp_sample to match the upstream source changes, including converting the computational examples from NumPy/Numba to JAX and aligning figure/styling metadata used by the book build.

Changes:

  • Switched simulation / importance-sampling code cells from Numba-based implementations to JAX (jax.random, jax.jit, jax.vmap, jax.lax).
  • Added GPU admonition include and a dependency install cell for jax, plus refreshed figure metadata blocks (captions/names).
  • Updated translation sync state metadata (source-sha, sync date, tool version, mode).

Reviewed changes

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

File Description
lectures/imp_sample.md Main lecture content update: JAX conversion, new install/include blocks, figure metadata changes, and revised exposition.
.translate/state/imp_sample.md.yml Translation-sync bookkeeping update to point at the new upstream source commit and tool version.

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

Comment thread lectures/imp_sample.md
Comment on lines +245 to +249
${E} \left[L\left(\omega^t\right)\right] = E \left[\prod_{i=1}^t \ell \left(\omega_i\right)\right]$。

如上所述,我们的计划是从 $q$ 中抽取序列 $\omega^t$,然后对似然比进行适当的重新加权。

如上所述,我们的计划是从 $q$ 中抽取序列 $\omega^t$,然后对似然比进行适当的重新加权
分布的变换在总体上成立,这与单次抽取的情况完全一样
Comment thread lectures/imp_sample.md
Comment on lines +475 to +479
mystnb:
figure:
caption: 'Monte Carlo and importance sampling estimates'
name: fig-imp-estimates
---
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request August 2, 2026 22:00 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 jax-conversion review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants