Skip to content

Seed learning_approximation and restore its four local references - #261

Merged
mmcky merged 1 commit into
mainfrom
recover/learning-approximation
Aug 20, 2026
Merged

Seed learning_approximation and restore its four local references#261
mmcky merged 1 commit into
mainfrom
recover/learning-approximation

Conversation

@mmcky

@mmcky mmcky commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Closes the older of this edition's two coverage gaps. Coverage moves 143/145 → 144/145; only mccall_risk remains (#258).

Resolves #210, including the four local references it asks for.

Why it was missing

The sync failed a structural parity check on 2026-07-26, recorded on lecture-python.myst#1004 and #1007 — two of the fifteen translation-sync-failure issues that were open estate-wide, none ever answered. Those two issue bodies are the primary evidence for the action-translation#118 block that #210 records.

The parity failure, characterised

Delivered with translate init -f at engine v0.26.0 against source a4fbd865. Two findings worth carrying to #118:

It is not sync-specific. The same parity failure reproduces on the init path, so all three write paths hit it.

But it is not deterministic either. Across six attempts the run refused four times and succeeded twice, always with the same signature: the output drops the leading ```{raw} header block, so directive #1 shifts from {raw} to {index} and the count lands one short — directive count differs: source has 36, output has 35. The guard is fail-closed and wrote nothing on any refusal.

That reframes #118 from "blocked" to "flaky, with a specific and diagnosable failure mode". The leading raw block being dropped is a much narrower target than "wholesale mismatch".

This PR is a successful run, verified after the fact rather than trusted:

Check Result
directives 36 / 36 vs source
code cells 17 / 17
headings 15 / 15
python syntax across all 17 cells 0 errors — matching source
figure captions 4 / 4 localised, 0 byte-identical to source
axis labels byte-identical to source none
i18n font block present

The four local references

#210 asks to "restore its four local references". They were pointing at the English site, because the lecture did not exist here:

{doc}`intermediate:learning_approximation`(英文版)

— an intersphinx link with an "English version" annotation, once in bounded_rationality.md and three times in genetic_classifier.md. All four now resolve locally as {doc}`learning_approximation`, and no intersphinx reference to it remains.

One thing to note for #254

init also reverted all 19 localised _toc.yml part captions to English (基础工具→Tools and Techniques, 搜索→Search, …) and added a dangling - file: mccall_risk entry for a lecture this edition does not have — which would have broken the build. Both were reverted; the ToC in this PR carries one added line, and all 19 Chinese captions are untouched.

Review note

Whole-file first translation, so the prose is entirely new here and worth a native read — particularly the treatment of 近似 / 学习算法 / 均衡计算 in the bounded-rationality register the neighbouring lectures use.

Closes the older of this edition's two coverage gaps. Coverage goes 143/145
-> 144/145.

The lecture has been missing since 2026-07-26, when its sync failed a
structural parity check — recorded on lecture-python.myst#1004 and #1007, and
tracked here as #210, blocked on QuantEcon/action-translation#118.

Delivered with `translate init -f` at engine v0.26.0 against source a4fbd865.

The parity failure reproduces on the init path, so it is not sync-specific —
but it is NOT deterministic. Across six attempts the run refused four times
and succeeded twice, always with the same signature: the output drops the
leading `{raw}` header block, so directive #1 shifts from {raw} to {index}
and the count comes up one short (36 vs 35). The guard is fail-closed and
wrote nothing on the refusals. This commit is a successful run, verified
after the fact rather than trusted.

Verified against source: 36/36 directives, 17/17 code cells, 15/15 headings,
0 python syntax errors across all 17 cells (matching source), 4/4 figure
captions localised with none byte-identical to source, no axis labels
byte-identical to source, and the i18n font block present.

The four local references named in #210 are restored: bounded_rationality.md
(x1) and genetic_classifier.md (x3) pointed at
{doc}`intermediate:learning_approximation`(英文版), an intersphinx link to
the English site with an "English version" annotation, because the lecture
did not exist here. They now resolve locally.

`init` also reverted all 19 localised _toc.yml part captions to English and
added a dangling `- file: mccall_risk` entry for a lecture this edition does
not have — the QuantEcon/action-translation#254 class. Both were reverted;
the ToC carries one added line.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 20, 2026 02:28
@netlify

netlify Bot commented Aug 20, 2026

Copy link
Copy Markdown

Deploy Preview for astonishing-narwhal-a8fc64 ready!

Name Link
🔨 Latest commit c26d69b
🔍 Latest deploy log https://app.netlify.com/projects/astonishing-narwhal-a8fc64/deploys/6a86666c7dc6170008537d41
😎 Deploy Preview https://deploy-preview-261--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 seeds the missing learning_approximation lecture into the Chinese edition, wires it into the book ToC, and converts four previously intersphinx (English) references to local {doc} links so the bounded-rationality sequence is complete.

Changes:

  • Add the full new lecture lectures/learning_approximation.md (MyST/Jupytext, figures, exercises/solutions, code cells).
  • Update local cross-references in bounded_rationality.md and genetic_classifier.md to point to the new local lecture.
  • Add the lecture to lectures/_toc.yml and record translation sync state in .translate/state/learning_approximation.md.yml.

Reviewed changes

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

Show a summary per file
File Description
lectures/learning_approximation.md New translated lecture content + executable notebook code cells, figures, and exercises.
lectures/genetic_classifier.md Replace intersphinx English link with local {doc} reference to the new lecture.
lectures/bounded_rationality.md Replace intersphinx English link with local {doc} reference (plus minor formatting).
lectures/_toc.yml Add learning_approximation to the bounded-rationality part so it builds/publishes.
.translate/state/learning_approximation.md.yml Add translation state metadata for the new lecture.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

import quantecon as qe
import matplotlib.pyplot as plt
import matplotlib as mpl # i18n
FONTPATH = "_fonts/SourceHanSerifSC-SemiBold.otf" # i18n
Comment on lines +216 to +217
if np.max(np.abs(s_new - s)) < tol:
return s, it
Comment on lines +678 to +681
for _ in range(1000):
ψ = (s - G_fixed) / (w2 + (s - G_fixed))
s = damp * s + (1 - damp) * s_from_psi(ψ)
return s
Comment on lines +740 to +742
fig, ax = plt.subplots(figsize=(7, 4.2))
for h, colour in [(0.03, 'C0'), (0.08, 'C1'), (0.20, 'C2')]:
ax.plot(G, kernel_smoother(h=h), 'o-', ms=3, lw=0.8, color=colour, label=f"$h = {h}$")
- 最小二乘学习选择了理性预期动态所排斥的低通胀均衡,而实验室中的受试者也走向了同样的方向。
- 一个学习菲利普斯曲线的政府作为本讲的结尾。
* {doc}`intermediate:learning_approximation`(英文版)— 当状态是连续的、对每一种情形都做出单独反应已不可能时,主体必须放弃什么,这引出了近似均衡以及学习算法与均衡计算算法之间的相似性。
* {doc}`learning_approximation`— 当状态是连续的、对每一种情形都做出单独反应已不可能时,主体必须放弃什么,这引出了近似均衡以及学习算法与均衡计算算法之间的相似性。
@github-actions

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request August 20, 2026 03:36 Inactive
@mmcky

mmcky commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Post-merge note: the build that was still in flight when this merged has since passedrun 32324785808, 1h08m, Build Download Notebooks (sphinx-tojupyter) success and Build HTML success, completing at 03:37:04Z (about 29 minutes after the merge).

Worth recording for two reasons. This edition's ci.yml is on: [pull_request] only, so nothing rebuilds main afterwards and a failure would have gone unsurfaced. And it is the stronger verification of the two: learning_approximation.md is a first translation that had never been executed anywhere, and this run executed all 17 of its code cells and rendered the HTML — where the pre-merge checks were static only (36/36 directives, ast.parse over the cells).

So the lecture that this issue's parity guard had blocked since 2026-07-26 is now confirmed to build, not merely confirmed to parse.

@mmcky

mmcky commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Correction to my post-merge note above. The claim that the preview build "executed all 17 code cells" was too strong: the import cell fails at runtime (FileNotFoundError: '_fonts/SourceHanSerifSC-SemiBold.otf' — the engine's hard-coded path, where this edition uses fonts/), and the preview build tolerated that as a mystnb warning rather than raising. It surfaced when the strict cache.yml build ran today (run 32331172292). One-line repair in #262. Lesson recorded: a green preview is not execution verification on this repo — the cache build is the real gate, and gap-fill verification must check the FONTPATH value, not just the block's presence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Seed learning_approximation and restore its four local references (blocked on action-translation#118)

2 participants