Skip to content

[action-translation] resync: ifp_advanced.md#115

Merged
mmcky merged 4 commits into
mainfrom
resync/ifp_advanced
Jul 18, 2026
Merged

[action-translation] resync: ifp_advanced.md#115
mmcky merged 4 commits into
mainfrom
resync/ifp_advanced

Conversation

@mmcky

@mmcky mmcky commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Forward Resync: ifp_advanced.md

Source: QuantEcon/lecture-python.mystlectures/ifp_advanced.md
Source commit: 60235eb
This PR resyncs the translation to match the current source document.

Reason: The target is an entirely different, older version of this lecture (using Numba/jitclass instead of JAX, different title 'Income Fluctuation Problem II' vs 'V', different code implementation, different exercises with detailed solutions on asset series simulation and violin plots, plus a 'Checking the Assumption' section with spectral radius matrix L discussion) that does not exist in the source. Meanwhile substantial source content (JAX implementation, wealth inequality Gini/top-share exercises with return vs labor income volatility comparisons) is missing from the target. This is a major mismatch with target containing unique content not in source.

Changes

Whole-file resync applied. The entire document was resynced in a single pass.


Created by action-translation forward resync

Copilot AI review requested due to automatic review settings July 18, 2026 07:38
@mmcky mmcky added action-translation-sync CLI resync PR (translate forward --github) resync Forward resync labels Jul 18, 2026
@netlify

netlify Bot commented Jul 18, 2026

Copy link
Copy Markdown

Deploy Preview for astonishing-narwhal-a8fc64 ready!

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

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 forward-resyncs the Chinese translation of ifp_advanced.md to match the current upstream lecture version, including updated structure, JAX-based implementation, and revised simulation/inequality exercises.

Changes:

  • Replaces the older Numba/jitclass-based lecture content with the newer JAX-based model, solver, and simulation workflow.
  • Updates lecture structure/metadata (translated title + section heading map) and refreshes exercises/solutions around wealth inequality measures.
  • Adds translation sync state metadata for traceability to the upstream commit.

Reviewed changes

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

File Description
lectures/ifp_advanced.md Full lecture resync: new front-matter translation metadata, JAX implementation, updated simulation + inequality sections and exercises.
.translate/state/ifp_advanced.md.yml Records source SHA/date/model/mode for the resync.

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

Comment thread lectures/ifp_advanced.md
Comment on lines +417 to +424
def solve_model(
ifp: IFP,
c_init: jnp.ndarray, # 内生网格上 σ 的初始猜测
a_init: jnp.ndarray, # 初始内生网格
tol: float = 1e-5,
max_iter: int = 1000
) -> jnp.ndarray:
" 使用 EGM 的时间迭代求解模型。 "
Comment thread lectures/ifp_advanced.md
Comment on lines +426 to +430
def condition(loop_state):
c_in, a_in, i, error = loop_state
return (error > tol) & (i < max_iter)

def body(loop_state):
Comment thread lectures/ifp_advanced.md
Comment on lines +437 to 441
i, error = 0, tol + 1
initial_state = (c_init, a_init, i, error)
final_loop_state = jax.lax.while_loop(condition, body, initial_state)
c_out, a_out, i, error = final_loop_state

Comment thread lectures/ifp_advanced.md
Comment on lines +392 to +395
# 对所有冲击组合进行向量化
η_grid, ζ_grid = jnp.meshgrid(η_draws, ζ_draws, indexing='ij')
terms = vmap(vmap(compute_term))(η_grid, ζ_grid)
return P[z, z_hat] * jnp.mean(terms)
Comment thread lectures/ifp_advanced.md
Comment on lines +598 to +600
# 前 p% 中的家庭数量
n_top = int(jnp.ceil(len(x) * p))
# 前 p% 持有的财富
@mmcky mmcky added the action-translation PRs created by QuantEcon/action-translation label Jul 18, 2026
@github-actions

github-actions Bot commented Jul 18, 2026

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request July 18, 2026 10:34 Inactive
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 18, 2026

Copy link
Copy Markdown

✅ Translation Quality Review

Verdict: PASS | Model: claude-sonnet-5 | Date: 2026-07-18


📝 Translation Quality

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

Summary: This is a high-quality whole-file resync translation that accurately preserves the technical content, mathematical formulations, and code structure of the source document. Terminology is consistent and follows established conventions. Minor concerns include the addition of 'intermediate:' prefixes in cross-document references and font-configuration code not present in the source, both of which appear to be intentional site-maintenance additions but warrant verification against the live documentation structure. Mathematical notation, LaTeX equations, and code blocks are preserved accurately and completely across the entire resynced document Technical terminology (e.g., 欧拉方程, 基尼系数, 马尔可夫链, 内生网格方法) is consistent with the glossary and used correctly throughout The translation maintains natural academic register in Chinese while accurately conveying complex economic and mathematical concepts

Suggestions:

  • Section 'Set Up': The English source references '{doc}ifp_egm_transient_shocks' without the 'intermediate:' prefix, but the translation adds '{doc}intermediate:ifp_egm_transient_shocks' - this cross-reference prefix change should be verified against the actual doc structure to ensure it doesn't break the link.
  • Section 'Using an Endogenous Grid': Similarly, '{doc}endogenous grid method <os_egm>' in English became '{doc}内生网格方法 <intermediate:os_egm>' with an added 'intermediate:' prefix - confirm this matches the correct target path in the current site structure.
  • Code cell in 'Overview' imports: The translation adds extra font-configuration lines (matplotlib font imports) not present in the English source code cell; while this is a common practice for CJK rendering, it introduces content changes beyond a translation and should be confirmed as intentional per project convention.

🔍 Diff Quality

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

Summary: The resync correctly replaced outdated content (old ifp lecture structure) with content matching the current source (ifp_advanced with JAX implementation), preserving section order, heading hierarchy, and adding a complete translation heading map.


This review was generated automatically by action-translation review mode.

mmcky and others added 2 commits July 18, 2026 21:20
The resynced file keeps Chinese plot labels but reverted the import
cell to the source's exact form, losing the Source Han Serif setup -
Chinese in figures would render as missing glyphs. Residual #107
class found in the merge review; applied wave-wide.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
These {doc} targets exist only in lecture-python.myst until Phase 2
translates them; qualifying with the intermediate: intersphinx prefix
gives working links now, and a future resync restores local refs once
the targets exist. Program decision recorded 2026-07-18 (Matt).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions
github-actions Bot temporarily deployed to pull request July 18, 2026 11:38 Inactive
@mmcky
mmcky merged commit 6d36118 into main Jul 18, 2026
7 checks passed
@mmcky
mmcky deleted the resync/ifp_advanced branch July 18, 2026 23:16
mmcky added a commit that referenced this pull request Jul 20, 2026
…#183)

Resolves the four failures reported in #182. All four are target-side
defects; the English source is healthy in every case.

likelihood_bayes — the font block called `mpl.font_manager.fontManager`
and `plt.rcParams` before `import matplotlib.pyplot as plt`. Newer
matplotlib no longer imports `font_manager` as a side effect of
`import matplotlib`, so this raised AttributeError (and would have
raised NameError on `plt`). Moved the pyplot import above both uses.
An audit of the font block across all 69 lectures found this the only
file with either ordering hazard.

kalman_2 — a `.text()` annotation drew the covariance matrix with
`\begin{bmatrix}`, which matplotlib mathtext cannot render (it supports
no LaTeX environments). Rewritten as `\left[ \substack{...} \right]`,
which renders an equivalent bracketed 2x2 matrix under mathtext, using
`\;` as the column separator rather than `&`. This keeps the
drop-usetex standard from #22 intact with no loss of information.
The lecture's other `\begin{bmatrix}` uses are inside `{math}` blocks,
rendered by MathJax, and are unaffected.

sir_model — the header directive had lost its argument: `{raw}` instead
of `{raw} jupyter`. The other 50 lectures carrying this directive kept
theirs.

ak_aiyagari — the file carried a stray fence at line 38 followed by a
duplicated copy of the original frontmatter, and a doubled closing
fence at EOF. The stray opener ran to line 56, swallowing both the H1
title and the `_admonition/gpu.md` include, which is what produced the
13 "headings start at H2" warnings. Removed both strays; the file's
fence structure now matches the English source exactly (122). The
`translation.title` field was also corrupt ("V, σ, μ") and has been set
to the lecture title. An edition-wide sweep found no other file with
unbalanced fences.

The last two are content corruption introduced in translation and
warrant engine issues against action-translation; they are not covered
by the existing #107/#115/#116/#117 set.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mmcky added a commit that referenced this pull request Jul 20, 2026
* FIX: execution and doc failures from the Anaconda 2026.07 cache build

Resolves the four failures reported in #182. All four are target-side
defects; the English source is healthy in every case.

likelihood_bayes — the font block called `mpl.font_manager.fontManager`
and `plt.rcParams` before `import matplotlib.pyplot as plt`. Newer
matplotlib no longer imports `font_manager` as a side effect of
`import matplotlib`, so this raised AttributeError (and would have
raised NameError on `plt`). Moved the pyplot import above both uses.
An audit of the font block across all 69 lectures found this the only
file with either ordering hazard.

kalman_2 — a `.text()` annotation drew the covariance matrix with
`\begin{bmatrix}`, which matplotlib mathtext cannot render (it supports
no LaTeX environments). Rewritten as `\left[ \substack{...} \right]`,
which renders an equivalent bracketed 2x2 matrix under mathtext, using
`\;` as the column separator rather than `&`. This keeps the
drop-usetex standard from #22 intact with no loss of information.
The lecture's other `\begin{bmatrix}` uses are inside `{math}` blocks,
rendered by MathJax, and are unaffected.

sir_model — the header directive had lost its argument: `{raw}` instead
of `{raw} jupyter`. The other 50 lectures carrying this directive kept
theirs.

ak_aiyagari — the file carried a stray fence at line 38 followed by a
duplicated copy of the original frontmatter, and a doubled closing
fence at EOF. The stray opener ran to line 56, swallowing both the H1
title and the `_admonition/gpu.md` include, which is what produced the
13 "headings start at H2" warnings. Removed both strays; the file's
fence structure now matches the English source exactly (122). The
`translation.title` field was also corrupt ("V, σ, μ") and has been set
to the lecture title. An edition-wide sweep found no other file with
unbalanced fences.

The last two are content corruption introduced in translation and
warrant engine issues against action-translation; they are not covered
by the existing #107/#115/#116/#117 set.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* CI: align build safety with the English source repo

Resolves #184. Brings ci.yml's execution safety in line with
lecture-python.myst, which is the standard the fleet builds to.

- `-n -W --keep-going` on the sphinx-tojupyter build. Previously this
  step ran with no flags, so a notebook whose cells raised still exited
  zero and the job went green. That is how the two execution breaks in
  #182 (likelihood_bayes, kalman_2) reached main with passing CI.
- Upload Execution Reports (Download Notebooks), so a failure in that
  step leaves a traceback artifact. Previously there was none, which is
  why #182 had to be diagnosed from the weekly Build Cache workflow's
  artifact rather than from CI directly.
- Clear stale Sphinx environment (`rm -rf _build/.doctrees`) before the
  builds, matching the source repo. The equivalent was present here only
  as a commented-out note.

The HTML artifact is renamed `execution-reports` -> `execution-reports-html`.
This is required, not cosmetic: upload-artifact@v7 runs with
`overwrite: false`, so adding a second upload under the same name would
collide when both steps fail in one run. The new names match the source
repo's convention (-notebooks / -latex / -html).

The PDF/LaTeX build is left commented out — see the issue for why that
one needs a human decision rather than mechanical alignment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* CI: set -eo pipefail on the sphinx-tojupyter step

Addresses Copilot review feedback on #185.

`shell: bash -l {0}` is a custom shell spec, so GitHub does not inject
`-eo pipefail` — it only does that for the bare `shell: bash` shorthand,
which expands to `bash --noprofile --norc -eo pipefail {0}`. Without it,
this step's exit code is that of the trailing `cp`, so a failing
`jb build` was masked.

`--keep-going` made that worse rather than better: it forces Sphinx to
emit output despite the errors, so the .ipynb files exist, `cp` succeeds,
and the step goes green. The flag added in this PR to surface failures
was producing the artifacts that hid them.

Scope is exactly one step — an audit of ci.yml shows every other step is
either single-command (its exit code is the command's) or uses the
default shell, which does carry `-e`.

Note the English source repo lecture-python.myst has the byte-identical
pattern, so this is inherited from the standard rather than introduced
here, and it deviates from the strict parity this PR set out to
establish. Reported upstream so the standard can catch up.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 action-translation-sync CLI resync PR (translate forward --github) resync Forward resync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants