29 / 90

第 29 日:評価 — データ分割・リーケージ・指標

訓練と評価を分離します。検証用・テスト用データを温存し、リーケージを排除し、誠実なベースラインと比較し、分布シフトを念頭に損失・精度・パープレキシティを読み取ります。

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

訓練・検証・テスト:比較方法を先に固定する

予測と観察の証拠を記録した後にのみ支援を利用できます。

前提条件

第 28 日の統計。予測・復習ルーチン。

学習目標

評価における訓練/検証/テスト分割の役割と、テストセットを一度だけ読む理由を説明し、調整を始める前に評価プロトコルを固定する。

手順

評価は『汎化するか?』という問いに、モデルが訓練で見ていないデータを使って答えます。訓練分割はパラメータを適合し、検証分割は選択(どのモデル、どの設定か)を導き、テスト分割は最後の手つかずの読み取りです。1,000 例を 60/20/20 に分けると 600 訓練、200 検証、200 テストになります。比較は、すべての候補が同じ分割・同じ指標で採点されるときだけ有効です——結果を見てからではなく、調整の前にプロトコルを固定してください。

演習と予測記録

ある学習者が 1,000 個のラベル付き例を持っています。(a) 60/20/20 で訓練/検証/テストを配分してください。(b) モデル M1 はテストセットで 40 回試した後に選ばれました——プロトコル違反とその帰結を指摘してください。(c) M1 と M2 のスコアを比較する前に同一でなければならない条件を述べてください。

独立習得基準

評価における各分割の役割を述べ、テスト再利用の違反を指摘し、調整前に固定プロトコルのチェックリストを書ける。

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

linking CC BY-SA 4.0 (book text) / modified MIT (sample code) share-alike

Dive into Deep Learning (d2l.ai)

著者・提供機関: Aston Zhang, Zachary C. Lipton, Mu Li, Alexander J. Smola | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Section: Model Selection, Underfitting, and Overfitting

検証バージョンと日付: Current online edition (Verified: 2026-10-30)

選定理由:

Primary open reference tying evaluation discipline (model selection, underfitting, overfitting) and optimization algorithms (gradient descent, minibatch) to the rest of the curriculum.

ソース前提知識:

Linear algebra, calculus, and probability at the Days 19-28 level.

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

All required formulas and worked numbers are reproduced as original explanations; the book is further reading.

比較対象候補リソースと選定評価 (2)
Deep Learning (Goodfellow, Bengio, Courville) ↗ compared_alternative [MIT Press; free HTML for reading, all rights reserved]

Detailed treatment of optimization difficulties (chapter 8) including saddle points and plateaus; all-rights-reserved text kept as a linking-only alternative.

fast.ai: Practical Deep Learning for Coders ↗ compared_alternative [Course site copyright / Apache-2.0 (fastai code)]

Strong practitioner framing, but organized around the fastai library and video lessons rather than self-contained mathematics.

linking CC BY 4.0

Google Machine Learning Crash Course

著者・提供機関: Google for Developers | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Modules: Training and Test Sets; Validation

検証バージョンと日付: Current online edition (Verified: 2026-10-30)

選定理由:

Industrial, beginner-legible treatment of training/test splitting and overfitting; complements d2l.ai's mathematical framing.

ソース前提知識:

Basic algebra; short self-contained modules.

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

Split discipline, leakage rules, and metric definitions are fully explained inside the lesson; the course is further reading.

比較対象候補リソースと選定評価 (2)
Dive into Deep Learning (d2l.ai) ↗ compared_selected_for_day29 [CC BY-SA 4.0 (book text) / modified MIT (sample code)]

Co-primary: deeper mathematical coverage of model selection, generalization, and optimization for the mathematics-track capstone.

scikit-learn: Model Evaluation documentation ↗ compared_alternative [BSD-3-Clause]

Normative reference once learners call sklearn; kept as an alternative because these days teach evaluation protocol before library usage.

02 120 分

ベースラインとデータリーケージ

独立習得確認(AI 支援なし)。

前提条件

活動 29-01 完了。このブロックは AI 支援なし。

学習目標

素朴なベースラインを計算し、評価が偽りの成功を報告する原因となるリーケージ機構を少なくとも 2 つ検出する。

手順

ベースラインは最も安価な誠実な予測器です。分類では多数派クラスです。1,000 例のうち 900 がクラス 0 なら、常にクラス 0 と予測して 0.90——どのモデルも 0.0 ではなく 0.90 と比較して評価されます。リーケージは評価データの情報が訓練へ流れ込むことです:分割前に全行で計算した正規化統計、分割をまたぐ重複行、ラベルから派生した特徴。どれも実力なしに評価を水増しします。

演習と予測記録

(a) 1,000 例中 900 例がクラス 0 のデータセット——多数派ベースラインは?モデルが 0.92 を報告:実際の改善は?(b) 全 1,000 行の平均で特徴を標準化してから 60/20/20 に分割するパイプライン——0.92 は信頼できるか、なぜ?(c) 50 行のテスト行が(重複して)600 行の訓練セットにも含まれる場合、評価はどうなるか?

独立習得基準

ベースラインを正しく計算し、少なくとも 2 つのリーケージ機構と修正(訓練のみ適合・重複除去・ラベル派生特徴の除去)を挙げ、水増し値ではなく誠実な低い値を報告できる。

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

linking CC BY-SA 4.0 (book text) / modified MIT (sample code) share-alike

Dive into Deep Learning (d2l.ai)

著者・提供機関: Aston Zhang, Zachary C. Lipton, Mu Li, Alexander J. Smola | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Section: Model Selection, Underfitting, and Overfitting; generalization discussion

検証バージョンと日付: Current online edition (Verified: 2026-10-30)

選定理由:

Primary open reference tying evaluation discipline (model selection, underfitting, overfitting) and optimization algorithms (gradient descent, minibatch) to the rest of the curriculum.

ソース前提知識:

Linear algebra, calculus, and probability at the Days 19-28 level.

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

All required formulas and worked numbers are reproduced as original explanations; the book is further reading.

比較対象候補リソースと選定評価 (2)
Deep Learning (Goodfellow, Bengio, Courville) ↗ compared_alternative [MIT Press; free HTML for reading, all rights reserved]

Detailed treatment of optimization difficulties (chapter 8) including saddle points and plateaus; all-rights-reserved text kept as a linking-only alternative.

fast.ai: Practical Deep Learning for Coders ↗ compared_alternative [Course site copyright / Apache-2.0 (fastai code)]

Strong practitioner framing, but organized around the fastai library and video lessons rather than self-contained mathematics.

linking CC BY 4.0

Google Machine Learning Crash Course

著者・提供機関: Google for Developers | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Modules: Overfitting; Generalization

検証バージョンと日付: Current online edition (Verified: 2026-10-30)

選定理由:

Industrial, beginner-legible treatment of training/test splitting and overfitting; complements d2l.ai's mathematical framing.

ソース前提知識:

Basic algebra; short self-contained modules.

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

Split discipline, leakage rules, and metric definitions are fully explained inside the lesson; the course is further reading.

比較対象候補リソースと選定評価 (2)
Dive into Deep Learning (d2l.ai) ↗ compared_selected_for_day29 [CC BY-SA 4.0 (book text) / modified MIT (sample code)]

Co-primary: deeper mathematical coverage of model selection, generalization, and optimization for the mathematics-track capstone.

scikit-learn: Model Evaluation documentation ↗ compared_alternative [BSD-3-Clause]

Normative reference once learners call sklearn; kept as an alternative because these days teach evaluation protocol before library usage.

03 120 分

指標と分布シフト

予測と観察の証拠を記録した後にのみ支援を利用できます。

前提条件

活動 29-02 完了。先に予測を記録すること。

学習目標

精度・交差エントロピー損失・パープレキシティを同じ評価証拠の異なる分解能として読み、モデル欠陥ではなく分布シフトによるスコア低下を診断する。

手順

精度は正解数を数えます。交差エントロピー(正解ラベルに与えた確率 p の平均 −ln p)は確信度も評価します——p = 0.9 は 0.105、p = 0.5 は 0.693、p = 0.1 は 2.303 のコストです。パープレキシティは exp(平均交差エントロピー)で、実効的な等確率の選択肢数です——常に正解トークンへ p = 0.5 を与えるモデルのパープレキシティは 2、4 択に一様に推測するモデルは 4 です。分布シフトは訓練≈テストの前提を壊します:昼間の写真で訓練した検出器を夜間に評価するのは、新しい分布での新しい評価であり、自動的にモデルの欠陥とは限りません。

演習と予測記録

(a) 正解ラベル確率 [0.9, 0.8, 0.7, 0.6] の平均交差エントロピーとパープレキシティを計算。(b) テスト分割で 18/20 = 0.90 の精度だが夜間写真では 11/20 のモデル——2 つの異なる説明とそれぞれの追試確認を挙げてください。(c) パープレキシティ 2.0 と 10.0 のどちらが良いか、それぞれ何を意味するか。

独立習得基準

NLL/パープレキシティの計算が正しく、精度と損失の違いを述べ、シフトと欠陥を区別してそれぞれ具体的な確認を示せる。

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

linking CC BY-SA 4.0 (book text) / modified MIT (sample code) share-alike

Dive into Deep Learning (d2l.ai)

著者・提供機関: Aston Zhang, Zachary C. Lipton, Mu Li, Alexander J. Smola | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Sections: Loss functions and cross-entropy; dataset shift discussion

検証バージョンと日付: Current online edition (Verified: 2026-10-30)

選定理由:

Primary open reference tying evaluation discipline (model selection, underfitting, overfitting) and optimization algorithms (gradient descent, minibatch) to the rest of the curriculum.

ソース前提知識:

Linear algebra, calculus, and probability at the Days 19-28 level.

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

All required formulas and worked numbers are reproduced as original explanations; the book is further reading.

比較対象候補リソースと選定評価 (2)
Deep Learning (Goodfellow, Bengio, Courville) ↗ compared_alternative [MIT Press; free HTML for reading, all rights reserved]

Detailed treatment of optimization difficulties (chapter 8) including saddle points and plateaus; all-rights-reserved text kept as a linking-only alternative.

fast.ai: Practical Deep Learning for Coders ↗ compared_alternative [Course site copyright / Apache-2.0 (fastai code)]

Strong practitioner framing, but organized around the fastai library and video lessons rather than self-contained mathematics.

linking CC BY 4.0

Google Machine Learning Crash Course

著者・提供機関: Google for Developers | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Modules: Classification accuracy; static versus dynamic evaluation

検証バージョンと日付: Current online edition (Verified: 2026-10-30)

選定理由:

Industrial, beginner-legible treatment of training/test splitting and overfitting; complements d2l.ai's mathematical framing.

ソース前提知識:

Basic algebra; short self-contained modules.

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

Split discipline, leakage rules, and metric definitions are fully explained inside the lesson; the course is further reading.

比較対象候補リソースと選定評価 (2)
Dive into Deep Learning (d2l.ai) ↗ compared_selected_for_day29 [CC BY-SA 4.0 (book text) / modified MIT (sample code)]

Co-primary: deeper mathematical coverage of model selection, generalization, and optimization for the mathematics-track capstone.

scikit-learn: Model Evaluation documentation ↗ compared_alternative [BSD-3-Clause]

Normative reference once learners call sklearn; kept as an alternative because these days teach evaluation protocol before library usage.

04 120 分

評価課題:有効な小規模実験を設計する

独立習得確認(AI 支援なし)。

前提条件

活動 29-01〜29-03 完了。独立・閉巻。

学習目標

小さな分類タスクのために完全で誠実な評価を設計し、すべての選択を正当化する。

手順

場面:800 個のラベル付き例、2 つの候補モデル、クラス比 80/20。評価を端から端まで設計しプロトコルとして書いてください:個数つきの分割、ベースライン、主指標と補助指標、リーケージ確認、テストセットを読む時点、陰性結果の報告の仕方。AI 支援なしで行います。狙いは運の良い数字ではなく、擁護できるプロトコルです。

演習と予測記録

800 例のタスクのプロトコルを書いてください(推奨 480/160/160):多数派ベースライン値、精度以外に報告する指標、3 つのリーケージ確認、そして高性能モデルがベースラインとしか張り合わない場合に書く一文。

独立習得基準

プロトコルが完全かつ自己完結し、ベースライン 0.80 と精度以外の指標を少なくとも 1 つ明記し、3 つのリーケージ確認と一度きりのテスト読み取りを含み、陰性結果の文を誇張なく書ける。

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

linking CC BY-SA 4.0 (book text) / modified MIT (sample code) share-alike

Dive into Deep Learning (d2l.ai)

著者・提供機関: Aston Zhang, Zachary C. Lipton, Mu Li, Alexander J. Smola | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Section: Model Selection, Underfitting, and Overfitting

検証バージョンと日付: Current online edition (Verified: 2026-10-30)

選定理由:

Primary open reference tying evaluation discipline (model selection, underfitting, overfitting) and optimization algorithms (gradient descent, minibatch) to the rest of the curriculum.

ソース前提知識:

Linear algebra, calculus, and probability at the Days 19-28 level.

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

All required formulas and worked numbers are reproduced as original explanations; the book is further reading.

比較対象候補リソースと選定評価 (2)
Deep Learning (Goodfellow, Bengio, Courville) ↗ compared_alternative [MIT Press; free HTML for reading, all rights reserved]

Detailed treatment of optimization difficulties (chapter 8) including saddle points and plateaus; all-rights-reserved text kept as a linking-only alternative.

fast.ai: Practical Deep Learning for Coders ↗ compared_alternative [Course site copyright / Apache-2.0 (fastai code)]

Strong practitioner framing, but organized around the fastai library and video lessons rather than self-contained mathematics.

linking CC BY 4.0

Google Machine Learning Crash Course

著者・提供機関: Google for Developers | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Modules: Training and Test Sets; Overfitting

検証バージョンと日付: Current online edition (Verified: 2026-10-30)

選定理由:

Industrial, beginner-legible treatment of training/test splitting and overfitting; complements d2l.ai's mathematical framing.

ソース前提知識:

Basic algebra; short self-contained modules.

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

Split discipline, leakage rules, and metric definitions are fully explained inside the lesson; the course is further reading.

比較対象候補リソースと選定評価 (2)
Dive into Deep Learning (d2l.ai) ↗ compared_selected_for_day29 [CC BY-SA 4.0 (book text) / modified MIT (sample code)]

Co-primary: deeper mathematical coverage of model selection, generalization, and optimization for the mathematics-track capstone.

scikit-learn: Model Evaluation documentation ↗ compared_alternative [BSD-3-Clause]

Normative reference once learners call sklearn; kept as an alternative because these days teach evaluation protocol before library usage.