[action-translation] resync: mle.md#136
Conversation
✅ 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 forward-resyncs the Chinese translation of lectures/mle.md to match the upstream lecture-python.myst source, updating both narrative and code examples (notably shifting the MLE implementation toward a JAX-based workflow) and recording sync state metadata for the translation tool.
Changes:
- Resynced
lectures/mle.mdcontent to upstream, including adding the GPU admonition include and updating code cells to use JAX (jax.grad,jax.vmap,jax.jacfwd) alongsidestatsmodelsexamples. - Added translation frontmatter (
translation.titleandtranslation.headings) for structured heading mapping. - Added
.translate/state/mle.md.ymlto record source SHA and resync metadata.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| lectures/mle.md | Full-document resync: adds translation metadata + GPU include, replaces older NumPy/SciPy/statsmodels-only workflow with JAX-based autodiff examples, and updates surrounding text/plots accordingly. |
| .translate/state/mle.md.yml | Records resync provenance (source SHA/date/model/mode) for the translation pipeline. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import numpy as np | ||
| from numpy import exp | ||
| from scipy.special import factorial | ||
| import jax.numpy as jnp | ||
| import jax | ||
| import pandas as pd | ||
| from mpl_toolkits.mplot3d import Axes3D | ||
| import statsmodels.api as sm | ||
| from typing import NamedTuple |
| def logL(β, model): | ||
| y = model.y | ||
| μ = jnp.exp(model.X @ β) | ||
| return jnp.sum(model.y * jnp.log(μ) - μ - jnp.log(factorial(y))) |
| return jnp.sum(model.y * jnp.log(μ) - μ - jnp.log(factorial(y))) | ||
| ``` | ||
|
|
||
| 为了求出`poisson_logL`的梯度,我们再次使用[jax.grad](https://jax.readthedocs.io/en/latest/_autosummary/jax.grad.html)。 |
| H_logL = jax.jacfwd(G_logL) | ||
| ``` | ||
|
|
||
| 我们的函数`newton_raphson`将接收一个`PoissonRegression`对象,该对象包含参数向量$\boldsymbol{\beta}_0$的初始猜测值。 |
| if display: | ||
| β_list = [f'{t:.3}' for t in list(model.β.flatten())] | ||
| update = f'{i:<13}{model.logL():<16.8}{β_list}' | ||
| β_list = [f"{t:.3}" for t in list(β.flatten())] | ||
| update = f"{i:<13}{logL(β, model):<16.8}{β_list}" | ||
| print(update) |
| reg_names = ["Model 1", "Model 2", "Model 3"] | ||
| info_dict = { | ||
| "Pseudo R-squared": lambda x: f"{x.prsquared:.2f}", | ||
| "No. observations": lambda x: f"{int(x.nobs):d}", | ||
| } |
| results_table.add_title( | ||
| "Table 1 - Explaining the Number of Billionaires \ | ||
| in 2008" | ||
| ) |
Re-applies Chinese code comments / print strings / plot labels that the resync reverted to English while the surrounding code is unchanged (action-translation#107 field validation, Track B wave). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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>
✅ Translation Quality ReviewVerdict: PASS | Model: claude-sonnet-5 | Date: 2026-07-19 📝 Translation Quality
Summary: The whole-file resync is largely accurate and fluent, correctly preserving code, math, and structure. A few sections show paraphrasing or added interpretive content instead of direct translation (particularly in the regression results discussion and predicted-vs-actual analysis), and one sentence about 'family of distributions' is garbled and should be corrected for clarity. Overall terminology usage aligns well with the glossary. Mathematical notation and LaTeX equations are accurately preserved throughout the resynced document Code blocks remain intact and unmodified, including comments appropriately translated to Chinese Technical terms like 最大似然估计, 泊松回归, 牛顿-拉夫森算法, 海森矩阵 are used consistently and correctly per the glossary The translation metadata (translation/headings) is properly structured for cross-referencing the resynced document Suggestions:
🔍 Diff Quality
Summary: The target document was correctly resynced to match the current source structure, content, and code cells, with an accurate translation heading map added to frontmatter. This review was generated automatically by action-translation review mode. |
The hand-restoration of localised code lines grabbed the wrong line of a print pair from the old pre-JAX lecture: the newton_raphson routine printed the iteration count twice and never printed the beta_hat estimate the following prose relies on. Restored upstream's second print line (using the new JAX-local beta). Also adds the missing trailing newline (engine issue tracked in QuantEcon/action-translation#116). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Forward Resync: mle.md
Source: QuantEcon/lecture-python.myst — lectures/mle.md
Source commit:
0bfcac8This PR resyncs the translation to match the current source document.
Reason: The target uses an entirely different (older) code implementation based on NumPy/SciPy/statsmodels instead of JAX (no jax.grad, jax.jacfwd, jax.vmap, NamedTuple classes), missing the GPU admonition include, missing prerequisites imports like gammaln, and uses class-based PoissonRegression/ProbitRegression with different method structures instead of functional JAX approach. It also lacks the jax-specific explanation of jax.grad/vmap/jacfwd/jacrev usage and documentation references. These represent substantive content/code differences requiring re-translation, not just style differences.
Changes
Whole-file resync applied. The entire document was resynced in a single pass.
Created by action-translation forward resync