Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

prob_meaning.md: assorted corrections

Đang mở
#877 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
20/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
documentation

Hướng nghiên cứu

Bắt đầu với lectures/prob_meaning.md và rà soát checklist đối chiếu với issue #878, issue này cho biết đã xử lý tất cả các mục. Kiểm tra các bài tập, ô mã, công thức, cách đặt tên, tham chiếu chéo và các biểu đồ bị ảnh hưởng; được xem là hoàn tất khi các sửa đổi được ghi chép đã có mặt và bài giảng vẫn nhất quán, dễ đọc.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

A collection of small issues found in lectures/prob_meaning.md.

  • Exercise pm_ex2 part (a): The question asks for the likelihood function for a sample of length $n$, but the solution provides the likelihood for a single flip ($n=1$). Either the question or the solution should be revised so they match.
  • Exercise pm_ex2 solution, before part (c): The sentence "Now pretend that the true value of $\theta = .4$..." appears twice — once as a standalone line before part (c) and again as the opening of part (c) itself. The first occurrence should be removed.
  • Bayesian section, missing setup before exercise pm_ex2: Bayes' Law, likelihood functions, and posterior distributions are not mentioned in the lecture text before the exercise — they only appear inside the solution. These concepts are already introduced in Probability with Matrices (prob_matrix), so a back-reference (e.g., "Recall the posterior distribution derived using Bayes' Law in {doc}Probability with Matrices <prob_matrix>") before the exercise would bridge the gap without duplicating material.
  • $n$-step posterior formula is used before it's derived: The solution code in part (c) uses $\text{Beta}(\alpha + k, \beta + n - k)$ via form_single_posterior, and all subsequent plots and coverage interval calculations depend on it. But the formal derivation doesn't appear until much later, in the "It is natural to extend the one-step Bayesian update..." section after the exercise. Moving the derivation earlier means that later section also needs to be revised or removed to avoid duplication.
  • Line length throughout code cells: Comments, docstrings, and code lines frequently exceed 80 characters, making them hard to read on the website. Sentences in comments should also start with a capital letter. Affected areas include the Bayesian class docstrings and various plotting cells (e.g., lines 506, 509, 551, 555, 682).
  • Variable naming: Several names are unclear or misleading:
    • ii is used both as a loop index and as a posterior distribution in list comprehensions (e.g., ii.cdf(...), ii.mean()). Use i for indices and post or posterior for distributions.
    • num / num_list → n_obs / n_obs_list (it's the number of observations, not a generic number)
    • step_num → n_obs (it's not a "step")
    • kk → k (no reason for the doubled name)
    • npt, nn, nI → more descriptive names like n_thetas, n_ns, n_Is
    • K → head_counts (capital K looks like a constant)
    • comp → table
  • PEP 8 naming conventions:
    • Bay_stat should be bay_stat or bayes — instance names should be snake_case, not PascalCase.
    • frequentist class should be Frequentist — class names should be PascalCase. (The Bayesian class already follows this convention.)
  • Plot label formatting: Line 590 uses 'n=%d thousand' % (num/1000), which produces awkward labels like "n=5 thousand". Use f-string formatting with comma separators instead, e.g., f'Posterior with n={n_obs:,}' → "n=5,000".
  • Typos and spelling:
    • "probabilties" → "probabilities" (line 76)
    • "to to help" → "to help" (line 36, doubled word)
    • "probabililty" → "probability" (lines 381, 546, 555, 564, 568, 572 — same misspelling repeated 6 times)
    • "statististian" → "statistician" (line 690)
  • Notation inconsistency: Line 331 refers to "the average of $P_{k,i}$" but the variable was defined as $\rho_{k,i}$ on line 325.
  • Subject-verb agreement (line 602): "posterior means converges" → "posterior mean converges"; "posterior standard deviations converges" → "posterior standard deviation converges".
  • LaTeX equations use * for multiplication (lines 638, 642, 646): Should use \cdot or juxtaposition instead.
  • Spiky posterior density plots: θ_values = np.linspace(0.01, 1, 100) only provides 100 grid points. The part (h) plot is zoomed to [0.3, 0.5], leaving ~20 points to render highly concentrated posteriors. Increase the grid resolution (e.g., 1000 points).
  • Cross-references say "this quantecon lecture" (lines 719–722): These render poorly in PDF where there's no hyperlink context. Replace with actual lecture titles: Non-Conjugate Priors, Posterior Distributions for AR(1) Parameters, and Forecasting an AR(1) Process.
  • Variance formula is wrong (lines 327–329): The variance of $\rho_{k,i}$ is given as $n \cdot \text{Prob}(X=k|\theta) \cdot (1 - \text{Prob}(X=k|\theta))$, but $\rho_{k,i}$ is a Bernoulli indicator, so its variance is $\text{Prob}(X=k|\theta) \cdot (1 - \text{Prob}(X=k|\theta))$ — no factor of $n$.
  • Upper and lower bounds swapped in part (e) (lines 521–522): ppf(0.05) (the 5th percentile) is assigned to upper_bound and ppf(0.95) (the 95th percentile) to lower_bound. Lines 672–673 do it correctly.
  • compare() skips $k=0$ (line 192): range(n) with i+1 starts at $k=1$, but $k=0$ is a valid binomial outcome.
  • Exercise pm_ex1 part 3 is vague: "With the Law of Large numbers in mind, use your code to say something" — say something about what?
  • Text says $\log(I)$ varies from 2 to 7 (line 286) but code has I_log_high = 6 (line 289).
  • Line 321 is imprecise: Says the observed fraction approximates $\theta$, but $f_k^I$ approximates $\text{Prob}(X=k|\theta)$, not $\theta$ itself.
  • Inconsistent bool-to-int conversion: The frequentist class uses * 1 (line 171) while Bayesian uses .astype(int) (line 455). Should be consistent — .astype(int) is clearer.

All items addressed in #878.

Ngôn ngữ chính
TeX
Star
123
Fork
57
Merge trung bình
3 ngày 14 giờ
Pull request đã merge (30 ngày)
11

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của QuantEcon/lecture-python.myst

Tất cả issue của QuantEcon/lecture-python.myst

Issue tương tự

Thêm issue về Documentation

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.