30 / 90

第 30 日:最適化 — 勾配降下とその失敗モード

凸な bowl 状関数で勾配降下の更新を手導出し、発散と遅すぎる収束の反例を作り、鞍点を説明し、成功を捏造しない失敗分析を練習します。この日で数学トラックを締めます。

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

凸な bowl 状関数上の勾配降下の仕組み

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

前提条件

第 29 日の評価。数学ブロックの 1 変数微分(べき乗則)。

学習目標

勾配降下の更新 x ← x − η·2x = x(1 − 2η) を導出し、因子 (1 − 2η) から最適化の全軌道を予測する。

手順

ここでの最適化は損失を反復的に下げることです。f(x) = x² の勾配は 2x なので、各ステップは x に (1 − 2η) を掛けます。x₀ = 4、η = 0.1 では因子は 0.8:x₁ = 3.2、x₂ = 2.56、x₃ = 2.048、一般に x_k = 4·0.8^k です。まず手で追い、短い Python ループで確認してください。η = 0.5 では因子が 0——この純粋な二次関数では 1 ステップで収束します。

演習と予測記録

f(x) = x²、x₀ = 4 について:(a) x_k の閉形式を書いてください。(b) η = 0.1 のとき x₁, x₂, x₃, x₁₀ を計算。(c) f(x) = (a/2)x² では因子は (1 − ηa) —— 安定条件 |1 − ηa| < 1 とそれが意味する学習率の上界を導いてください。

独立習得基準

閉形式を導出し、4 つの反復値がすべて正しく、η < 2/a の条件と a = 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 ↗

該当セクション・タイムスタンプ: Chapter Optimization Algorithms: Gradient Descent

検証バージョンと日付: 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 3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions No video, audio, transcript or frame redistribution permitted

Gradient Descent, How Neural Networks Learn

著者・提供機関: Grant Sanderson (3Blue1Brown) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Neural networks chapter 2: the gradient and the descent update

検証バージョンと日付: Neural networks series chapter 2, 2017 (Verified: 2026-10-30)

選定理由:

Visual intuition connecting the gradient vector to steepest descent; complements d2l.ai's worked equations for the optimization day.

ソース前提知識:

High-school functions and slope intuition.

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

The lesson contains complete derivations and numerical traces; the video is optional visual intuition.

比較対象候補リソースと選定評価 (2)
Convex Optimization (Boyd and Vandenberghe) ↗ compared_alternative [Cambridge University Press; free PDF for individual use]

A detailed optimization text, kept as an advanced alternative; its scope exceeds a single study day.

Deep Learning chapter 8 (Goodfellow, Bengio, Courville) ↗ compared_alternative [MIT Press; free HTML for reading, all rights reserved]

Rigorous discussion of saddle points and plateaus in high-dimensional optimization; kept as a linking-only alternative.

02 120 分

不安定なステップ幅:発散と遅すぎる収束

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

前提条件

活動 30-01 完了。AI 支援なし。

学習目標

同じ関数で 3 つの最適化の失敗モード——発散振動・凍結振動・遅すぎる収束——を作り、任意の η を因子 (1 − 2η) で分類する。

手順

最適化では因子 (1 − 2η) がすべてを決めます:|因子| < 1 なら収束、因子 = −1 なら永遠に振動、|因子| > 1 なら符号を交互にしながら発散、小さな正の因子は実用上無意味なほど遅い収束です。f(x) = x²、x₀ = 4 で各モードを計算し、軌跡を正直に記録してください——これらは異常ではなく実在の失敗モードです。

演習と予測記録

f(x) = x²、x₀ = 4 で分類して追跡:(a) η = 1.2 → x₁, x₂, x₃ と |x₁₀|。(b) η = 1.0 → ステップ 1 以降の軌道。(c) η = 0.01 → x₁₀、およびこの『動く』学習率がなぜ実用上の失敗か。(d) 各モード名を付けてください。

独立習得基準

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 ↗

該当セクション・タイムスタンプ: Chapter Optimization Algorithms: Gradient Descent; learning-rate selection

検証バージョンと日付: 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 3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions No video, audio, transcript or frame redistribution permitted

Gradient Descent, How Neural Networks Learn

著者・提供機関: Grant Sanderson (3Blue1Brown) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Neural networks chapter 2: step size intuition

検証バージョンと日付: Neural networks series chapter 2, 2017 (Verified: 2026-10-30)

選定理由:

Visual intuition connecting the gradient vector to steepest descent; complements d2l.ai's worked equations for the optimization day.

ソース前提知識:

High-school functions and slope intuition.

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

The lesson contains complete derivations and numerical traces; the video is optional visual intuition.

比較対象候補リソースと選定評価 (2)
Convex Optimization (Boyd and Vandenberghe) ↗ compared_alternative [Cambridge University Press; free PDF for individual use]

A detailed optimization text, kept as an advanced alternative; its scope exceeds a single study day.

Deep Learning chapter 8 (Goodfellow, Bengio, Courville) ↗ compared_alternative [MIT Press; free HTML for reading, all rights reserved]

Rigorous discussion of saddle points and plateaus in high-dimensional optimization; kept as a linking-only alternative.

03 120 分

鞍点と誠実な失敗分析

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

前提条件

活動 30-02 完了。支援前に予測を記録すること。

学習目標

f(x,y) = x² − y² で勾配ゼロが最小値でない理由を説明し、成功を捏造せずに最適化の失敗を報告する練習をする。

手順

鞍点では勾配は 0 ですが最小値ではありません。f(x,y) = x² − y² の原点は x 方向には最小、y 方向には最大です。勾配降下は x ← x(1−2η) と更新しますが、y ← y(1+2η) です。厳密な算術では y = 0 は 0 のままなので、(0.5, 0) から始めた実行は (0,0)——鞍点——に収束し、小さな y₀ = 0.001 だけがゆっくり脱出します(y₁₀ ≈ 0.006、k = 20 で f は負)。失敗分析の規則:観察された軌跡・診断した原因・修正を報告する——失敗を成功に丸めてはいけません。

演習と予測記録

(a) ∇f = (2x, −2y) が (0,0) で消え、任意の ε ≠ 0 で f(0, ε) = −ε² < 0 となることを確認。(b) (0.5, 0) から η = 0.1 で開始したとき、10 ステップ後に勾配降下はどこに到達し、その点は最小値か?(c) 損失が 2.0 → 2.6 → 3.5 → 4.9 → 6.8 と進む訓練ログ:誠実な失敗分析エントリ(原因仮説・修正・再確認)を書いてください。

独立習得基準

−ε² の議論で鞍点を検証し、停滞した実行を正しく計算し、失敗エントリが原因・修正・再確認を記録し、捏造された改善がない。

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

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 ↗

該当セクション・タイムスタンプ: Chapter Optimization Algorithms: Optimization and Deep Learning (local minima, saddle points)

検証バージョンと日付: 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 3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions No video, audio, transcript or frame redistribution permitted

Gradient Descent, How Neural Networks Learn

著者・提供機関: Grant Sanderson (3Blue1Brown) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Neural networks chapter 2: valleys, plateaus, and saddle intuition

検証バージョンと日付: Neural networks series chapter 2, 2017 (Verified: 2026-10-30)

選定理由:

Visual intuition connecting the gradient vector to steepest descent; complements d2l.ai's worked equations for the optimization day.

ソース前提知識:

High-school functions and slope intuition.

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

The lesson contains complete derivations and numerical traces; the video is optional visual intuition.

比較対象候補リソースと選定評価 (2)
Convex Optimization (Boyd and Vandenberghe) ↗ compared_alternative [Cambridge University Press; free PDF for individual use]

A detailed optimization text, kept as an advanced alternative; its scope exceeds a single study day.

Deep Learning chapter 8 (Goodfellow, Bengio, Courville) ↗ compared_alternative [MIT Press; free HTML for reading, all rights reserved]

Rigorous discussion of saddle points and plateaus in high-dimensional optimization; kept as a linking-only alternative.

04 120 分

評価課題:最適化の振る舞いを予測・分類・診断する

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

前提条件

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

学習目標

無支援で、最適化の機構を新しい二次関数に移し、ある学習率を分類し、記述された失敗を診断する。

手順

g(x) = 2x² の勾配は 4x なので x ← x(1 − 4η) です。予測してから分類してください:x₀ = 2、η = 0.3 では因子は −0.2——収束、振動、それとも発散?x₁, x₂, x₃ を計算。g の安定上界を求めてください。最後に損失軌跡 2.0 → 2.6 → 3.5 → 4.9 を診断し、修正エントリを書いてください。

演習と予測記録

g(x) = 2x²、x₀ = 2、η = 0.3:(a) x_k の閉形式。(b) x₁, x₂, x₃ とモード。(c) η の安定上界。(d) 損失軌跡 2.0 → 2.6 → 3.5 → 4.9 を診断し、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 ↗

該当セクション・タイムスタンプ: Chapter Optimization Algorithms: Gradient Descent; Optimization and Deep Learning

検証バージョンと日付: 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 3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions No video, audio, transcript or frame redistribution permitted

Gradient Descent, How Neural Networks Learn

著者・提供機関: Grant Sanderson (3Blue1Brown) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Neural networks chapter 2: the gradient and the descent update

検証バージョンと日付: Neural networks series chapter 2, 2017 (Verified: 2026-10-30)

選定理由:

Visual intuition connecting the gradient vector to steepest descent; complements d2l.ai's worked equations for the optimization day.

ソース前提知識:

High-school functions and slope intuition.

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

The lesson contains complete derivations and numerical traces; the video is optional visual intuition.

比較対象候補リソースと選定評価 (2)
Convex Optimization (Boyd and Vandenberghe) ↗ compared_alternative [Cambridge University Press; free PDF for individual use]

A detailed optimization text, kept as an advanced alternative; its scope exceeds a single study day.

Deep Learning chapter 8 (Goodfellow, Bengio, Courville) ↗ compared_alternative [MIT Press; free HTML for reading, all rights reserved]

Rigorous discussion of saddle points and plateaus in high-dimensional optimization; kept as a linking-only alternative.