25 / 90

第 25 日:確率の基礎:事象・条件付き確率・ベイズ

明示的な標本空間で事象を数え、条件付けで標本空間を縮約し、ベイズの定理で逆向きに求め、経験頻度と保証された確率を区別する。予測・証跡・回復は 480 分の台帳内で記録する。

数学とアルゴリズム基礎 480 分(8 時間の集中学習)
01 120 分

標本空間・事象・数え上げ

予測と観測の証跡を記録した後にのみ補助を利用できます。

前提条件

Day 24(線形代数のまとめ)を完了すること。行き詰まった場合は、続行する前に Day 21 を復習する。

学習目標

標本空間を定義し、等しく起こりうる結果を列挙して、明示した公平性と独立性の仮定のもとで数え上げにより事象の確率を求める。

手順

参照資料: この活動に割り当てられた既存の読解・練習時間内で、Stat 110: Strategic Practice and Homework Problems の Strategic Practice and Homework 1; linked problem and solution document を参照し、ローカル課題とのつながりを一つ自分の言葉で説明する。既存の演習と合格基準は維持し、外部資料が開けない場合は本コース独自の説明を使う。確率モデルは、等しく起こりうる結果からなる標本空間 $\Omega$ を仮定し、事象 $A$ に $P(A) = |A|/|\Omega|$ を割り当てる。公平で独立な 6 面サイコロ 2 個では標本空間は 36 個の順序対 $(a,b)$ で、各対の確率は $1/36$。周辺分布が公平でも独立とは限らず、2 個が常に同じ目なら和が 7 の確率は 0、少なくとも 1 個が 6 の確率は $1/6$。必須作業:まず個数を予測してから、和が 7 になる対と、少なくとも 1 個が 6 の目になる対を列挙する(包除原理で $(6,6)$ の二重計上を避ける)。任意作業:必須の証跡がそろってからのみ、コイン 3 枚で同じ数え上げを繰り返す。

演習と予測記録

公平で独立な 6 面サイコロ 2 個(各順序対の確率は $1/36$)について、予測してから計算せよ:(a) $P(\text{和}=7)$、(b) $P(\text{少なくとも 1 個が }6)$。各答えを 36 個の順序対に対する分数と小数で示し、依拠した公平性と独立性の仮定を述べること。

独立習得基準

標本空間が 36 個の順序対として書かれ、2 つの確率が暗記ではなく各サイコロが公平で互いに独立という明示した仮定(各順序対の確率は $1/36$)のもとでの数え上げで導かれていること。

公式ソースリソースと権利証跡

linking Harvard University copyright; no open reuse license verified linking only; no reproduction

Stat 110: Strategic Practice and Homework Problems

著者・提供機関: Joe Blitzstein (Harvard University) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Strategic Practice and Homework 1; linked problem and solution document

検証バージョンと日付: Public edition checked 2026-11-01; moving pages may change

選定理由:

Concept-organized questions plus solutions supply probability teaching practice missing from reference notes. Use early sets, not an entire semester or an unverified free textbook.

ソース前提知識:

Counting, fractions and the Day 25 probability definitions; use only the identified early problems.

安全フォールバック(オフライン回復性):

Use the original localized explanations, exercises and checks already present in this activity; no external account or purchase is required for that fallback.

比較対象候補リソースと選定評価 (2)
OpenStax Introductory Statistics 2e ↗ compared_alternative [CC BY-NC-SA 4.0]

Retained for accessible definitions and a full statistics sequence; Stat 110 adds targeted probability practice.

OpenIntro Statistics ↗ compared_alternative [CC BY-SA 3.0]

Comparable introductory statistics text; remains a supplementary reference for estimation rather than replacing concept-targeted probability practice.

linking CC BY-NC-SA 4.0 noncommercial share-alike

Introductory Statistics 2e

著者・提供機関: OpenStax, Rice University (Barbara Illowsky, Susan Dean) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Chapter 3: Probability Topics (sample spaces, events, equally likely outcomes)

検証バージョンと日付: 2e web edition (Verified: 2026-10-30)

選定理由:

Peer-reviewed open textbook with beginner-grade rigor for sample spaces and counting-based probability.

ソース前提知識:

High-school algebra

安全フォールバック(オフライン回復性):

All required definitions, counts, and worked answers are reproduced locally in this lesson.

比較対象候補リソースと選定評価 (3)
MIT OCW 6.041 Probabilistic Systems Analysis ↗ compared_deferred [CC BY-NC-SA 4.0]

Rigorous but paced for a full graduate semester; exceeds the depth needed for Days 25-27 training-objective foundations.

Khan Academy Statistics and Probability ↗ compared_alternative [CC BY-NC-SA 3.0]

Accessible video-first coverage; noncommercial/share-alike terms and video pacing make it a supplementary rather than primary link.

Harvard Stat 110 Introduction to Probability (Blitzstein & Hwang) ↗ compared_alternative [CRC Press copyright (book); free lecture videos]

Strong intuition-building course; the printed textbook is paywalled, so it complements rather than replaces the openly licensed OpenStax text.

linking Stanford copyright; public course notes No text extraction or redistribution permitted

CS229 Review of Probability Theory

著者・提供機関: Stanford CS229 course staff (Arian Maleki, Tom Do) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Section 2: Probability spaces, events, and axioms

検証バージョンと日付: 2020 public course notes (Verified: 2026-10-30)

選定理由:

Compact machine-learning-oriented probability review connecting axioms to model assumptions.

ソース前提知識:

Multivariate calculus notation exposure

安全フォールバック(オフライン回復性):

Self-contained definitions and derivations in activity instructions and offline guide.

比較対象候補リソースと選定評価 (2)
OpenStax Introductory Statistics 2e ↗ compared_alternative [CC BY-NC-SA 4.0]

Co-selected: provides the gentler beginner narrative; CS229 provides the ML-oriented notation bridge.

MIT OCW 18.05 Introduction to Probability and Statistics ↗ compared_alternative [CC BY-NC-SA 4.0]

Strong full-course treatment with noncommercial/share-alike terms; heavier than the compact CS229 reference for this three-day block.

02 120 分

条件付き確率と独立性

独立習得チェック(AI 補助なし)。

前提条件

前のアクティビティを完了すること。行き詰まった場合は、続行する前にアクティビティ 01 の Day 21 復習の案内に従う。

学習目標

標本空間を制限して $P(A\mid B)=P(A\cap B)/P(B)$ を計算し、積の恒等式 $P(A\cap B)=P(A)P(B)$ で独立性を検証する。

手順

参照資料: この活動に割り当てられた既存の読解・練習時間内で、Stat 110: Strategic Practice and Homework Problems の Strategic Practice and Homework 2: Conditional Probability; problems and solutions を参照し、ローカル課題とのつながりを一つ自分の言葉で説明する。既存の演習と合格基準は維持し、外部資料が開けない場合は本コース独自の説明を使う。$B$ で条件付けすると標本空間は $B$ に縮小し再正規化される。公式を暗記するのではなく縮小した空間の中で考える。必須作業:次の (a)-(c) を自力で解き、それぞれどの制限された標本空間を使ったか記す。独立性は直感ではなく検証すべき数値の恒等式である。

演習と予測記録

公平で独立なサイコロ 2 個(各順序対の確率は $1/36$)。(a) 1 個目が偶数とわかったとき $P(\text{和}=8)$ を求めよ。(b) 和が 7 とわかったとき $P(\text{1 個目}=4)$ を求めよ。(c) 「1 個目が偶数」と「和が 7」は独立か?$P(\text{偶数})\cdot P(\text{和}=7)$ と $P(\text{偶数}\cap\text{和}=7)$ を比較せよ。

独立習得基準

3 つすべてを制限された数え上げで自力導出し、各部分で条件付けた集合を明示し、積の確認 $1/12 = 3/36$ の後にのみ独立と主張していること。

公式ソースリソースと権利証跡

linking Harvard University copyright; no open reuse license verified linking only; no reproduction

Stat 110: Strategic Practice and Homework Problems

著者・提供機関: Joe Blitzstein (Harvard University) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Strategic Practice and Homework 2: Conditional Probability; problems and solutions

検証バージョンと日付: Public edition checked 2026-11-01; moving pages may change

選定理由:

Concept-organized questions plus solutions supply probability teaching practice missing from reference notes. Use early sets, not an entire semester or an unverified free textbook.

ソース前提知識:

Counting, fractions and the Day 25 probability definitions; use only the identified early problems.

安全フォールバック(オフライン回復性):

Use the original localized explanations, exercises and checks already present in this activity; no external account or purchase is required for that fallback.

比較対象候補リソースと選定評価 (2)
OpenStax Introductory Statistics 2e ↗ compared_alternative [CC BY-NC-SA 4.0]

Retained for accessible definitions and a full statistics sequence; Stat 110 adds targeted probability practice.

OpenIntro Statistics ↗ compared_alternative [CC BY-SA 3.0]

Comparable introductory statistics text; remains a supplementary reference for estimation rather than replacing concept-targeted probability practice.

linking CC BY-NC-SA 4.0 noncommercial share-alike

Introductory Statistics 2e

著者・提供機関: OpenStax, Rice University (Barbara Illowsky, Susan Dean) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Chapter 3: Probability Topics (conditional probability, independence)

検証バージョンと日付: 2e web edition (Verified: 2026-10-30)

選定理由:

Clear treatment of conditional probability via restricted sample spaces matching this activity's method.

ソース前提知識:

High-school algebra

安全フォールバック(オフライン回復性):

All required definitions, counts, and worked answers are reproduced locally in this lesson.

比較対象候補リソースと選定評価 (3)
MIT OCW 6.041 Probabilistic Systems Analysis ↗ compared_deferred [CC BY-NC-SA 4.0]

Rigorous but paced for a full graduate semester; exceeds the depth needed for Days 25-27 training-objective foundations.

Khan Academy Statistics and Probability ↗ compared_alternative [CC BY-NC-SA 3.0]

Accessible video-first coverage; noncommercial/share-alike terms and video pacing make it a supplementary rather than primary link.

Harvard Stat 110 Introduction to Probability (Blitzstein & Hwang) ↗ compared_alternative [CRC Press copyright (book); free lecture videos]

Strong intuition-building course; the printed textbook is paywalled, so it complements rather than replaces the openly licensed OpenStax text.

linking Stanford copyright; public course notes No text extraction or redistribution permitted

CS229 Review of Probability Theory

著者・提供機関: Stanford CS229 course staff (Arian Maleki, Tom Do) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Section 3: Conditional probability and independence

検証バージョンと日付: 2020 public course notes (Verified: 2026-10-30)

選定理由:

ML-oriented reference for the independence product rule used later in model assumptions.

ソース前提知識:

Multivariate calculus notation exposure

安全フォールバック(オフライン回復性):

Self-contained definitions and derivations in activity instructions and offline guide.

比較対象候補リソースと選定評価 (2)
OpenStax Introductory Statistics 2e ↗ compared_alternative [CC BY-NC-SA 4.0]

Co-selected: provides the gentler beginner narrative; CS229 provides the ML-oriented notation bridge.

MIT OCW 18.05 Introduction to Probability and Statistics ↗ compared_alternative [CC BY-NC-SA 4.0]

Strong full-course treatment with noncommercial/share-alike terms; heavier than the compact CS229 reference for this three-day block.

03 120 分

ベイズの定理と経験頻度対確率

予測と観測の証跡を記録した後にのみ補助を利用できます。

前提条件

前のアクティビティを完了すること。行き詰まった場合は、続行する前にアクティビティ 01 の Day 21 復習の案内に従う。

学習目標

全確率の分母を使ってベイズの定理 $P(D\mid +)=P(+\mid D)P(D)/P(+)$ を適用し、シード固定のシミュレーションで経験頻度と保証された確率を区別する。

手順

検査の例:有病率 $P(D)=0.01$、感度 $P(+\mid D)=0.99$、偽陽性率 $P(+\mid \bar D)=0.05$。全確率で $P(+)$ を求め、次に $P(D\mid +)$ を求める。次に実行:python3 -c "import random; random.seed(25); pairs=[(random.randint(1,6), random.randint(1,6)) for _ in range(36)]; print(sum(1 for a,b in pairs if a+b==7))" で、36 組中の和 7 の観測頻度を $1/6$ と比較する。

演習と予測記録

(a) この検査場面で $P(D\mid +)$ を計算せよ。(b) 36 組のシミュレーションで観測された和 7 の頻度を報告し、$1/6$ と一致しなくてよい理由を説明せよ。(c) $n$ 回の試行で一度も観測されない事象の確率は正確に 0 か?

独立習得基準

ベイズ計算に全確率の分母が示され、シミュレーション頻度が正直に報告され、ゼロカウントの注意点と頻度/確率の区別が自分の言葉で述べられていること。

公式ソースリソースと権利証跡

linking CC BY-NC-SA 4.0 noncommercial share-alike

Introductory Statistics 2e

著者・提供機関: OpenStax, Rice University (Barbara Illowsky, Susan Dean) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Chapter 3: Probability Topics (Bayes' rule, law of total probability); Chapter 1 (relative frequency)

検証バージョンと日付: 2e web edition (Verified: 2026-10-30)

選定理由:

Open treatment of Bayes' rule and the relative-frequency interpretation of probability.

ソース前提知識:

High-school algebra

安全フォールバック(オフライン回復性):

All required definitions, counts, and worked answers are reproduced locally in this lesson.

比較対象候補リソースと選定評価 (3)
MIT OCW 6.041 Probabilistic Systems Analysis ↗ compared_deferred [CC BY-NC-SA 4.0]

Rigorous but paced for a full graduate semester; exceeds the depth needed for Days 25-27 training-objective foundations.

Khan Academy Statistics and Probability ↗ compared_alternative [CC BY-NC-SA 3.0]

Accessible video-first coverage; noncommercial/share-alike terms and video pacing make it a supplementary rather than primary link.

Harvard Stat 110 Introduction to Probability (Blitzstein & Hwang) ↗ compared_alternative [CRC Press copyright (book); free lecture videos]

Strong intuition-building course; the printed textbook is paywalled, so it complements rather than replaces the openly licensed OpenStax text.

linking PSF License Version 2

Python 3 random: Generate pseudo-random numbers

著者・提供機関: Python Software Foundation | オリジナル出所URL ↗

該当セクション・タイムスタンプ: random.seed, random.randint, random.choices (reproducible simulations)

検証バージョンと日付: Python 3.12 documentation (Verified: 2026-10-30)

選定理由:

Normative reference for seeded pseudo-random sampling used in the empirical-frequency experiment.

ソース前提知識:

Basic Python syntax

安全フォールバック(オフライン回復性):

Use the installed interpreter's help(random) and the included deterministic commands.

比較対象候補リソースと選定評価 (2)
NumPy random Generator documentation ↗ compared_deferred [BSD 3-Clause]

Faster vectorized sampling but adds a third-party dependency before the tensor track; deferred to the models-and-training days.

Python secrets module documentation ↗ compared_rejected_for_days_25_27 [PSF License Version 2]

Cryptographically secure randomness is unnecessary for reproducible statistical pedagogy and obscures the seed-based determinism the exercises require.

04 120 分

独立習得チェック:確率の基礎

独立習得チェック(AI 補助なし)。

前提条件

前のアクティビティを完了すること。行き詰まった場合は、続行する前にアクティビティ 01 の Day 21 復習の案内に従う。

学習目標

見知らぬ確率問題を自力で解き、用いた仮定(事前確率・尤度・独立性)をすべて明示する。

手順

このチェック中は AI・参照資料・四則演算を超える計算機は使わない。3 問すべてを解き、検算前に予測を記録し、間違いを見直して抜けた概念には回復リンクをたどる。 最初の無支援の試行は変更せず保存する。その後の誤りの見直しと支援つき回復は別段階であり、抜けた概念は、答えを事前に見せない新しい同等の無支援チェックに合格して初めて修復済みとみなす。 再チェック(回復後のみ・無支援・ヒントなし):(a) $P(\text{spam})=0.3$、$P(w\mid\text{spam})=0.8$、$P(w\mid\text{ham})=0.2$ のとき $P(\text{spam}\mid w)$ を求めよ。(b) 52 枚の山から非復元で 2 枚引く:$P(\text{両方ハート})$ を求めよ。(c) 2 語 $w_1,w_2$ を使うナイーブベイズのスコアが仮定する分解を書き、実テキストでそれが崩れる理由を 1 つ挙げよ。このカードは再チェックの答えを載せない:習得基準と同じ基準(述べたモデルからの厳密な値、すべての仮定の明示)で採点し、解き終えてから別の方法(1000 通の頻度表、または順序対の数え上げ)でのみ検算する。(a) を誤ったら day-25-act-03(ベイズの定理、全確率の分母)、(b) は day-25-act-02(従属な事象)と day-25-act-01(数え上げ)、(c) は day-25-act-02(独立性)で回復する。

演習と予測記録

(a) スパムフィルタ:$P(\text{spam})=0.2$、不審な単語 $w$ について $P(w\mid\text{spam})=0.9$、$P(w\mid\text{ham})=0.1$。$P(\text{spam}\mid w)$ を求めよ。(b) 52 枚の山から非復元で 2 枚引く:$P(\text{両方エース})$ を求めよ。(c) 複数の不審な単語特徴でメッセージを採点する多特徴ナイーブベイズ分類器が追加する条件付き独立性の仮定を述べ、それが現実的か答えよ。((a) は単一特徴なので、その事後確率はベイズの定理だけから出る。)

独立習得基準

自力の答えが $9/13$ と $1/221$ に一致し、仮定したモデル(事前確率・尤度・条件付き独立・非復元抽出)が明示され、誤りは回復リンクにつながり、抜けた概念は新しい同等の無支援チェックでのみ修復されること。

公式ソースリソースと権利証跡

linking CC BY-NC-SA 4.0 noncommercial share-alike

Introductory Statistics 2e

著者・提供機関: OpenStax, Rice University (Barbara Illowsky, Susan Dean) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Chapter 3: Probability Topics (review problems)

検証バージョンと日付: 2e web edition (Verified: 2026-10-30)

選定理由:

Open end-of-chapter review coverage aligned with this day's assessment scope.

ソース前提知識:

High-school algebra

安全フォールバック(オフライン回復性):

The assessment is self-contained with original items and worked reference answers.

比較対象候補リソースと選定評価 (3)
MIT OCW 6.041 Probabilistic Systems Analysis ↗ compared_deferred [CC BY-NC-SA 4.0]

Rigorous but paced for a full graduate semester; exceeds the depth needed for Days 25-27 training-objective foundations.

Khan Academy Statistics and Probability ↗ compared_alternative [CC BY-NC-SA 3.0]

Accessible video-first coverage; noncommercial/share-alike terms and video pacing make it a supplementary rather than primary link.

Harvard Stat 110 Introduction to Probability (Blitzstein & Hwang) ↗ compared_alternative [CRC Press copyright (book); free lecture videos]

Strong intuition-building course; the printed textbook is paywalled, so it complements rather than replaces the openly licensed OpenStax text.

linking Stanford copyright; public course notes No text extraction or redistribution permitted

CS229 Review of Probability Theory

著者・提供機関: Stanford CS229 course staff (Arian Maleki, Tom Do) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Sections 2-3: axioms, conditional probability, Bayes' rule

検証バージョンと日付: 2020 public course notes (Verified: 2026-10-30)

選定理由:

Reference for the probability toolkit this assessment checks without assistance.

ソース前提知識:

Multivariate calculus notation exposure

安全フォールバック(オフライン回復性):

The assessment is self-contained with original items and worked reference answers.

比較対象候補リソースと選定評価 (2)
OpenStax Introductory Statistics 2e ↗ compared_alternative [CC BY-NC-SA 4.0]

Co-selected: provides the gentler beginner narrative; CS229 provides the ML-oriented notation bridge.

MIT OCW 18.05 Introduction to Probability and Statistics ↗ compared_alternative [CC BY-NC-SA 4.0]

Strong full-course treatment with noncommercial/share-alike terms; heavier than the compact CS229 reference for this three-day block.