隨機變數與機率分佈
僅在記錄預測與觀察證據後才允許輔助。
前置要求
完成第 25 天(機率基礎);如遇阻塞,使用所列恢復連結(第 21 天)。
學習目標
把離散隨機變數定義為從結果到數的函數,驗證機率分佈表,並把它與詞元上的類別分佈聯繫起來。
操作指引
隨機變數 $X$ 把樣本空間的每個結果映射為一個數;其分佈列出滿足 $\sum_x P(X=x)=1$ 的 $P(X=x)$。公平骰的 $X$ 是 $\{1,\dots,6\}$ 上的均勻分佈。必做:計算骰子的 $E[X]$,再驗證取值 $\{0,1,2,3\}$ 上的詞元型分佈 $p=[0.5,0.25,0.125,0.125]$。
自主實作與記錄
(a) 求公平骰的 $E[X]$,並解釋非整數期望為何不與結果矛盾。(b) 對 $\{0,1,2,3\}$ 上的 $p=[0.5,0.25,0.125,0.125]$,驗證 $\sum p = 1$ 並求 $P(X\ge 2)$。(c) 把 $p$ 解釋為四個詞元類型上的類別分佈:哪個是最可能的詞元?
$E[X] = (1+2+3+4+5+6)/6$。$P(X\ge 2) = P(X=2)+P(X=3)$。期望是機率加權的長期平均,不是必然出現的結果。
(a) $E[X] = 21/6 = 3.5$:期望是長期平均而非骰面。(b) $0.5+0.25+0.125+0.125=1$;$P(X\ge 2)=0.125+0.125=0.25$。(c) $p=0.5$ 的詞元 0 最可能——類別分佈就是離散類型上的機率表,正是語言模型輸出層產生的形狀。
驗證正規化 $\sum p = 1$、算出 $P(X\ge2)=0.25$,並能把期望解釋為區別於任何單一結果的平均。
權威來源資源與權利證明
Introductory Statistics 2e
對應章節 / 時間戳: Chapter 4: Discrete Random Variables (probability distribution functions)
驗證版本與日期: 2e web edition (Verified: 2026-10-30)
Open textbook treatment of discrete random variables and distribution tables.
High-school algebra; Day 25 probability foundations
All required definitions, tables, and worked answers are reproduced locally in this lesson.
對比候選資源與選型分析 (3)
Rigorous but paced for a full graduate semester; exceeds the depth needed for Days 25-27 training-objective foundations.
Accessible video-first coverage; noncommercial/share-alike terms and video pacing make it a supplementary rather than primary link.
Strong intuition-building course; the printed textbook is paywalled, so it complements rather than replaces the openly licensed OpenStax text.
CS229 Review of Probability Theory
對應章節 / 時間戳: Section 2.4-2.5: Random variables, distributions, expectation
驗證版本與日期: 2020 public course notes (Verified: 2026-10-30)
ML-oriented definition of random variables bridging to categorical token distributions.
Multivariate calculus notation exposure
Self-contained definitions and derivations in activity instructions and offline guide.
對比候選資源與選型分析 (2)
Co-selected: provides the gentler beginner narrative; CS229 provides the ML-oriented notation bridge.
Strong full-course treatment with noncommercial/share-alike terms; heavier than the compact CS229 reference for this three-day block.