Seed learning_approximation and restore its four local references - #261
Conversation
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>
✅ Deploy Preview for astonishing-narwhal-a8fc64 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
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.mdandgenetic_classifier.mdto point to the new local lecture. - Add the lecture to
lectures/_toc.ymland 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 |
| if np.max(np.abs(s_new - s)) < tol: | ||
| return s, it |
| for _ in range(1000): | ||
| ψ = (s - G_fixed) / (w2 + (s - G_fixed)) | ||
| s = damp * s + (1 - damp) * s_from_psi(ψ) | ||
| return s |
| 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`— 当状态是连续的、对每一种情形都做出单独反应已不可能时,主体必须放弃什么,这引出了近似均衡以及学习算法与均衡计算算法之间的相似性。 |
|
Post-merge note: the build that was still in flight when this merged has since passed — run 32324785808, 1h08m, Worth recording for two reasons. This edition's 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. |
|
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 ( |
Closes the older of this edition's two coverage gaps. Coverage moves 143/145 → 144/145; only
mccall_riskremains (#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-failureissues 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 -fat engine v0.26.0 against sourcea4fbd865. Two findings worth carrying to #118:It is not sync-specific. The same parity failure reproduces on the
initpath, 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:
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:
— an intersphinx link with an "English version" annotation, once in
bounded_rationality.mdand three times ingenetic_classifier.md. All four now resolve locally as{doc}`learning_approximation`, and no intersphinx reference to it remains.One thing to note for #254
initalso reverted all 19 localised_toc.ymlpart captions to English (基础工具→Tools and Techniques, 搜索→Search, …) and added a dangling- file: mccall_riskentry 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.