21 / 90

Day 21: 計算グラフと誤差逆伝播とのつながり(復習)

これは定着・復習日である。計算グラフを前向き・逆向きに手でたどり、共有ノードの勾配が累積されることを証明し、1 つの有限差分ハーネスで本ブロックの全結果を再検証する。検索想起と復習は 480 分の台帳に含まれる。

AI数学・微積分・線形代数 480 分のアクティブ学習(集中学習 8 時間)
01 120 分

計算グラフ:局所微分と逆方向の累積

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

前提条件

Day 19-20 の連鎖律と勾配ドリル。不安なステップがあれば、まず Day レベルの回復リンクを開くこと。

学習目標

スカラー式を計算グラフに分解し、各ノードの前向きの値を計算してから、局所的な連鎖律の因子を掛けて導関数を逆方向に伝播させる。

手順

L = (a*b + c)^2 で a = 2, b = 3, c = 1 とする。前向き:n1 = a*b = 6、n2 = n1 + c = 7、L = n2^2 = 49。逆方向:dL/dn2 = 2*n2 = 14、dL/dn1 = 14 * ∂n2/∂n1 = 14 * 1 = 14、dL/dc = 14 * ∂n2/∂c = 14、dL/da = 14 * ∂n1/∂a = 14 * b = 42、dL/db = 14 * ∂n1/∂b = 14 * a = 28。各ステップは 1 つの局所エッジに適用した Day 19-20 の連鎖律である。コードで a を摂動する前に dL/da を予測せよ。

演習と予測記録

(2, 3, 1) での L = (a*b + c)^2 のグラフを描き、前向きの値 6, 7, 49 を埋め、すべての入力勾配を手計算せよ。dL/da, dL/db, dL/dc を中心有限差分で検証し、一致を記録せよ。

独立習得基準

助けなしで前向きの値 6, 7, 49 と逆方向の値 42, 28, 14 を再現し、すべてのエッジで局所微分を言え、自分の有限差分実行が各手計算勾配と一致する。

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

linking MIT

micrograd: A tiny scalar-valued autograd engine

著者・提供機関: Andrej Karpathy | オリジナル出所URL ↗

該当セクション・タイムスタンプ: micrograd/engine.py: class Value (_backward closures and backward() topological sort); README 'Example usage'

検証バージョンと日付: 2022 (verified 2026-10-30)

選定理由:

The scalar computational graph in this lesson is exactly the micrograd engine walkthrough; it previews the autograd project without importing any material.

ソース前提知識:

Chain rule and partial derivatives (Study Days 19-20).

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

The full forward and backward pass is derived locally with numeric verification; no video is required.

比較対象候補リソースと選定評価 (2)
PyTorch Autograd Internals ↗ compared_alternative [Modified BSD]

Normative production documentation, but micrograd's pure Python implementation provides far superior initial clarity.

3Blue1Brown: What is Backpropagation? ↗ compared_alternative [3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions]

High visual quality, pairs cleanly as optional supplementary visual reference.

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

OpenStax Calculus Volume 3

著者・提供機関: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Section 4.5: tree-diagram rule used to justify backward accumulation

検証バージョンと日付: OpenStax Calculus Volume 3 web edition (verified 2026-10-30)

選定理由:

Provides the formal chain rule statement that the graph walkthrough applies node by node.

ソース前提知識:

Scalar chain rule (day-19) and partial derivatives (day-20).

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

The derivation uses only local rules already proven on Days 19-20.

比較対象候補リソースと選定評価 (2)

Selected as the lecture-depth companion for partial derivatives; OpenStax Volume 3 remains the written primary reference.

Khan Academy: Multivariable Calculus ↗ compared_alternative [CC BY-NC-SA 4.0]

Strong visual coverage of gradients, but the OpenStax text better matches the lesson's theorem-plus-hand-check structure.

02 120 分

共有ノード:勾配の寄与が累積される理由

独立練習:先に予測し、記録した無支援の試行を保存する。その後の助けは別段階の「支援つき回復」であり、その概念を独立した証拠とみなすには新しい同等の無支援チェックが必要。

前提条件

前のアクティビティを完了していること。詰まった場合は記載の回復リンクを使う。

学習目標

1 つのノードが 2 つの消費側を持つとき、その全勾配は両方の寄与の和になることを証明し、再利用変数の反例を直接代入で検証する。

手順

ケース 1:L = (a + 1)^2、a = 2。L = u * v(u = a + 1, v = a + 1)と書くと、変数 a は両方の因子で共有され、2 経路で L に届く。経路の見方:u 経路は v * du/da = u * 1 = u を、v 経路は u * dv/da = u を寄与し、合計 dL/da = 2u = 6(a = 2)。単一経路の答え 3 が反例の誤りである。ケース 2:w = (u + v)^2 で u = x^2, v = 2x、x = 1:dw/dx = 2(u + v) * (2x + 2) = 2 * 3 * 4 = 24。 保存した試行の後で助けを使った場合は「支援つき回復」として扱う:元の試行は変更せず、その概念を修復済みと呼ぶ前に新しい同等の無支援チェックに合格する。

演習と予測記録

計算して検証せよ:(a) L = (a + 1)^2 の a = 2 での dL/da — 両経路の寄与と誤った単一経路の値を示す。(b) w = (u + v)^2, u = x^2, v = 2x の x = 1 での dw/dx — 木の規則と (x^2 + 2x)^2 の展開の両方で求める。

独立習得基準

助けなしで共有ノードに入るすべての経路を特定し、6 と 24 をそれぞれ独立チェック付きで導き、1 経路を落とすとちょうどその寄与分だけ少なくなる理由を説明できる。

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

linking MIT

micrograd: A tiny scalar-valued autograd engine

著者・提供機関: Andrej Karpathy | オリジナル出所URL ↗

該当セクション・タイムスタンプ: micrograd/engine.py: class Value (_backward closures and backward() topological sort); README 'Example usage'

検証バージョンと日付: 2022 (verified 2026-10-30)

選定理由:

The reusable-variable counterexample in this activity mirrors the accumulation behavior a correct engine must implement.

ソース前提知識:

Computational graph walkthrough (day-21-act-01).

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

The counterexample is proven locally by direct substitution and a finite-difference check.

比較対象候補リソースと選定評価 (2)
PyTorch Autograd Internals ↗ compared_alternative [Modified BSD]

Normative production documentation, but micrograd's pure Python implementation provides far superior initial clarity.

3Blue1Brown: What is Backpropagation? ↗ compared_alternative [3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions]

High visual quality, pairs cleanly as optional supplementary visual reference.

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

OpenStax Calculus Volume 3

著者・提供機関: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Section 4.5: sum over all dependency paths when a variable is reused

検証バージョンと日付: OpenStax Calculus Volume 3 web edition (verified 2026-10-30)

選定理由:

States the rule that total derivatives add contributions along every path, which the counterexample verifies.

ソース前提知識:

Scalar chain rule (day-19) and partial derivatives (day-20).

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

The proof reduces the composition to a single-variable expansion, independent of the external source.

比較対象候補リソースと選定評価 (2)

Selected as the lecture-depth companion for partial derivatives; OpenStax Volume 3 remains the written primary reference.

Khan Academy: Multivariable Calculus ↗ compared_alternative [CC BY-NC-SA 4.0]

Strong visual coverage of gradients, but the OpenStax text better matches the lesson's theorem-plus-hand-check structure.

03 120 分

有限差分検証ハーネスと検索想起の復習

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

前提条件

前のアクティビティを完了していること。詰まった場合は記載の回復リンクを使う。

学習目標

再利用可能な中心差分ヘルパーを書いて本ブロックの主要な数値を再検証し Days 16-20 を定着させ、ブロックの定義について閉ブックの想起練習を行う。

手順

ヘルパー def central_fd(f, x, h=1e-5): return (f(x + h) - f(x - h)) / (2 * h) を書き、実行前に各行を予測せよ:d/dx (3x + 1)^2 at x = 1 -> 24。d/dx (5x - 2)^3 at x = 1 -> 135。d/dx (x^2 + 1)^2 at x = 2 -> 40。(2, 1) での x^2 y + 3y - x の ∂/∂x と ∂/∂y -> 3 と 7。(3, 4) での x^2 + y^2 の勾配ノルム -> 10。(2, 3, 1) での L = (a*b + c)^2 の dL/da, dL/db, dL/dc -> 42, 28, 14。

演習と予測記録

6 行すべてでハーネスを実行し、次にノートを閉じて記憶から想起せよ:導関数の極限定義、連鎖律の記述、偏微分の定義、勾配ノルムの性質、共有変数の経路和の規則。抜けたものを印付けせよ。

独立習得基準

ハーネスの全行が予測値と小数点以下 4 桁まで一致し、想起リストが 5 つの記述をすべて再現し、印付きの抜けが多くて 1 件でその回復計画がある。

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

linking PSF License Version 2

The Python Tutorial: Numbers and Expressions

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

該当セクション・タイムスタンプ: Section 3.1.1 Numbers: arithmetic used by the verification harness

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

選定理由:

Reference for the arithmetic in the central finite-difference helper reused across the block.

ソース前提知識:

Able to run a short Python file from the terminal.

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

The harness listing is embedded and runs on a standard Python install.

比較対象候補リソースと選定評価 (2)
math — Mathematical functions ↗ compared_alternative [PSF License Version 2]

Extends the operator set to transcendental functions; kept as a follow-on once the arithmetic expressions are fluent.

The Python Tutorial: Floating Point Arithmetic Issues ↗ compared_alternative [PSF License Version 2]

Explains binary float representation limits; deferred to the numerics days where tolerance reasoning is rehearsed.

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

OpenStax Calculus Volume 1

著者・提供機関: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Sections 3.1-3.6 review scope for the block retrieval check

検証バージョンと日付: OpenStax Calculus Volume 1 web edition (verified 2026-10-30)

選定理由:

Optional drill source for extra derivative review during the consolidation block.

ソース前提知識:

Derivative rules for powers and polynomials (Study Days 16-18).

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

The retrieval checklist is self-contained in the lesson.

比較対象候補リソースと選定評価 (3)
MIT OpenCourseWare 18.01SC Single Variable Calculus ↗ compared_selected_for_visual_practice [CC BY-NC-SA 4.0]

Strong exercises and transcripts, but the noncommercial share-alike terms and course navigation make OpenStax the primary stable text.

Paul's Online Math Notes: Calculus I ↗ compared_rejected_for_reuse [All Rights Reserved]

Useful reference, but rights and redistribution terms are less suitable for embedded recovery material.

SciPy Numerical Differentiation Documentation ↗ compared_selected_for_numerics [BSD-3-Clause]

A primary API reference for numerical derivative step-size behavior; it complements rather than replaces the hand derivation.

04 120 分

ブロック復習評価:グラフ勾配、エッジケース、回復計画

独立習得チェック(AI 支援なし)。

前提条件

前のアクティビティを完了していること。詰まった場合は記載の回復リンクを使う。

学習目標

小さな計算グラフの全入力勾配を独立して計算し、微分不可能なエッジを処理し、各弱点を復習日に対応付けた回復計画を作る。

手順

閉ブック・AI なし。パート 1:L = (a*b)^2 + c で a = 1, b = 2, c = 3。前向き:n1 = a*b = 2、n2 = n1^2 = 4、L = n2 + c = 7。dL/da, dL/db, dL/dc を逆方向に手計算せよ。パート 2:ReLU ノード f(x) = max(0, x) は x = 0 で左の傾き 0、右の傾き 1。その導関数が存在するか、エンジンがよく使う規約は何か、下流の勾配に注意が必要な理由を述べよ。パート 3:抜けた結果をそれを教えた日(Days 16-18 極限/微分、19 連鎖律、20 勾配)に対応付けた回復計画を書け。

演習と予測記録

提出物:前向きノード値を含む 3 つの勾配、ReLU のエッジケース判定、回復計画。提出前にパート 1 を数値検証せよ。

独立習得基準

助けなしで:前向きの値 2, 4, 7 と勾配 8, 4, 1 を数値検証;ReLU の判定が「未定義」と「慣例の 0」を区別;回復計画がすべての抜けを具体的な日に対応付ける。

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

linking MIT

micrograd: A tiny scalar-valued autograd engine

著者・提供機関: Andrej Karpathy | オリジナル出所URL ↗

該当セクション・タイムスタンプ: micrograd/engine.py: class Value (_backward closures and backward() topological sort); README 'Example usage'

検証バージョンと日付: 2022 (verified 2026-10-30)

選定理由:

Optional preview of the autograd engine that the independent graph computation imitates.

ソース前提知識:

All of Study Days 19-21 activities 1-3.

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

The assessment is fully specified locally with a worked reference answer.

比較対象候補リソースと選定評価 (2)
PyTorch Autograd Internals ↗ compared_alternative [Modified BSD]

Normative production documentation, but micrograd's pure Python implementation provides far superior initial clarity.

3Blue1Brown: What is Backpropagation? ↗ compared_alternative [3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions]

High visual quality, pairs cleanly as optional supplementary visual reference.

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

OpenStax Calculus Volume 3

著者・提供機関: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Section 4.6: gradients exist only where partials exist; review scope for edge cases

検証バージョンと日付: OpenStax Calculus Volume 3 web edition (verified 2026-10-30)

選定理由:

Frames the ReLU kink edge case reviewed in the block assessment.

ソース前提知識:

Partial derivatives and the multivariable chain rule.

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

The edge case is resolved locally with left and right slopes.

比較対象候補リソースと選定評価 (2)

Selected as the lecture-depth companion for partial derivatives; OpenStax Volume 3 remains the written primary reference.

Khan Academy: Multivariable Calculus ↗ compared_alternative [CC BY-NC-SA 4.0]

Strong visual coverage of gradients, but the OpenStax text better matches the lesson's theorem-plus-hand-check structure.