讀書筆記 (1):Deep Learning 的起點 - 從 AI 到 DL 的演進

|10 min read|Updated: |
AIMachine LearningDeep LearningNotes

最近為了準備學校的考試,花了一些時間重新整理 Deep Learning 的基礎知識。雖然考試是全英文的,但為了讓自己理解得更清楚,決定用「中英對照」的方式來整理這份筆記。

本篇主要涵蓋 AI 領域最基礎的架構:從最外層的 AI,到中間的 ML,再到核心的 DL,以及它們背後的數學與學習方式。

1. The Layered Relationship

Figure 1: The Hierarchy of AI. AI 是最廣泛的概念,ML 是其子集,DL 則是 ML 中使用神經網路的技術,而 Generative AI 是 DL 的新興應用。

Concept: 就像俄羅斯娃娃一樣,AI 包著 ML,ML 包著 DL,每一層都更專精。

Table 1: Core Concepts of AI

ConceptKey DefinitionMy Understanding
Artificial Intelligence (AI)The broadest field aimed at simulating human intelligence.最廣泛的概念,目標是讓機器能如人類一般。
Machine Learning (ML)A subset of AI that enables systems to learn from data without explicit programming.重點在 Data-Driven。不用手寫規則 (if-else),而是讓機器從資料中找規則。
Deep Learning (DL)A subset of ML utilizing multi-layered Neural Networks to learn complex patterns.關鍵是 Neural Networks。能自動進行 Feature Extraction,不用人工設計特徵。
Generative AIA class of DL models (e.g., LLMs, GANs) that create new content.最近最紅的領域,重點在於 Create 而不是單純的分類或預測。

1.1 Machine Learning v.s. Deep Learning

Figure 2: ML vs DL Workflow. 傳統 ML 依賴人工特徵工程,而 DL 能自動從原始資料中學習特徵。

Key Difference: DL 最強大的地方在於 Feature Learning,它能自己學會「什麼是重要的特徵」,不再需要人類專家手動設計。

  • Machine Learning: Requires manual, expert-driven feature engineering.
  • Deep Learning: Automatically learns features directly from raw data.

2. Learning Tasks and Paradigms

機器學習的方法主要可以分為三種,這取決於我們給機器什麼樣的資料。

2.1 Learning Paradigms

Figure 3: Three Learning Paradigms. 監督式學習 (標籤)、非監督式學習 (結構) 與強化學習 (獎勵) 的核心差異。

Analogy: Supervised 像是有老師教;Unsupervised 像是自修;RL 像是訓練寵物。

  • Supervised Learning (監督式學習)

    • Definition: Learning from labeled data.
    • Example: Image classification with known labels (e.g., This is a cat, this is a dog).
    • 筆記: 就像有老師帶著做題目,有標準答案。
  • Unsupervised Learning (非監督式學習)

    • Definition: Finding structure in unlabeled data.
    • Example: Clustering customer groups (e.g., grouping customers by purchasing behavior).
    • 筆記: 沒有標準答案,讓機器自己去發現資料的內在結構(例如分群)。
  • Reinforcement Learning (RL, 強化學習)

    • Definition: Learning through trial and error with a Reward mechanism.
    • Core Loop: Agent \leftrightarrow Environment (Action, Reward).
    • 筆記: 就像訓練寵物,做對了給獎勵 (Reward),做錯了懲罰,透過試誤法 (Trial and Error) 來學習最佳策略。

2.2 Learning Tasks

  • Classification (分類): Predicting a discrete label (e.g., Spam or Not Spam).
  • Regression (回歸): Predicting a continuous numerical value (e.g., Predicting House Prices).
  • Clustering (分群): Grouping similar data points together.

Figure 4: Learning Tasks. 分類 (找邊界)、回歸 (找趨勢) 與分群 (找聚落) 的視覺化差異。

Goal: 根據輸出的型態來決定任務:是類別 (Category)?是數值 (Value)?還是結構 (Structure)?

3. Mathematical Foundations

雖然現在 Framework 很方便,但理解背後的數學對於 Debug 和調參還是很重要的。

Figure 5: Mathematical Pillars. 支撐 Deep Learning 的三大數學基石:處理資料的線性代數、優化參數的微積分、以及評估不確定性的機率統計。

Foundation: 這三者缺一不可:線性代數是骨架,微積分是引擎,機率是導航。

Table 2: Mathematical Foundations of DL

FoundationCore Role in DLKey Terminology
Linear Algebra
(線性代數)
Essential for representing and manipulating data structure.Tensors (張量), Matrix Multiplication (矩陣運算)。
DL 的本質就是大量的矩陣運算。
Calculus
(微積分)
The engine for optimizing the model parameters.Derivatives (導數), Gradient Descent (梯度下降)。
Chain Rule 是 Backpropagation (反向傳播) 的核心。
Probability
(機率統計)
Quantifying uncertainty and evaluating performance.Loss Functions (損失函數), Evaluation Metrics (評估指標)。

3.1 Data Structures in DL

在 Deep Learning 中,我們使用不同維度的資料結構來儲存數據。

  • Scalar (純量, 0D Tensor): 一個單獨的數值 (例如:溫度 25.5 度)。
  • Vector (向量, 1D Tensor): 一排數值 (例如:[x, y, z] 座標)。
  • Matrix (矩陣, 2D Tensor): 二維的數值表格 (例如:Excel 表格)。
  • Tensor (張量, nD Tensor): n 維的數值陣列 (例如:RGB 圖片是 3D Tensor [Height, Width, Channel])。

Figure 6: Data Structures. 從 0D 純量到 nD 張量的維度變化。

Terminology: 在 DL 中,我們幾乎只講 Tensor,因為它能概括所有維度的資料。

3.2 Matrix Multiplication

在線性代數中,矩陣運算是最基礎的操作。

Figure 7: Matrix Multiplication in NN. 神經網路層與層之間的訊號傳遞,本質上就是一連串的矩陣乘法運算。

Mechanism: 神經網路的「思考」過程,其實就是一連串的矩陣乘法與非線性轉換。

3.3 Calculus: The Engine of Optimization

微積分在 Deep Learning 中主要用於「優化」。我們需要知道如何調整參數 (Weights) 才能讓模型的預測誤差 (Loss) 最小化。

  • Derivatives (導數): 告訴我們函數在某一點的變化率(斜率)。在 DL 中,這代表「如果我稍微增加這個參數,Loss 會變大還是變小?」。
  • Gradient Descent (梯度下降): 利用導數指引的方向,一步步往山谷底(Loss 最小點)走。

Figure 8: Gradient Descent Visualization. 尋找 Loss Function 最低點的過程,就像是下山的步伐,斜率 (Gradient) 決定了方向與步幅。

Optimization: 我們的目標是找到山谷的最低點 (Global Minimum),那裡代表模型的誤差最小。

3.4 Probability: Managing Uncertainty

現實世界的資料充滿了雜訊和不確定性。機率統計提供了量化這些不確定性的框架。

  • Uncertainty (不確定性): 模型對於預測結果的信心程度 (Confidence)。例如:「這張照片有 80% 的機率是貓」。
  • Loss Functions (損失函數): 許多 Loss Function (如 Cross-Entropy) 都是基於機率理論中的 Maximum Likelihood Estimation (MLE) 推導出來的,目標是找到一組參數,讓模型產生觀測資料的機率最大化。

Figure 9: Quantifying Uncertainty. 機率分佈幫助我們理解模型預測的不確定性。

Reality: 真實世界充滿雜訊,模型給出的永遠是一個「機率」,而不是絕對的真理。

4. Conclusion

這篇文章從最宏觀的 AI 領域開始,一路聚焦到 Machine Learning 的三大學習方式,最後停在 Deep Learning 的數學基石。

  • Hierarchy: 我們確認了 AI > ML > DL 的層級關係。
  • Paradigms: 理解了 Supervised (有標籤)、Unsupervised (找結構) 與 RL (獎勵機制) 的差異。
  • Foundations: 知道了 Linear Algebra (資料結構)、Calculus (優化引擎) 與 Probability (不確定性) 是如何支撐起整個 DL 框架的。

有了這些基礎知識後,下一篇我們將正式進入「訓練模型」的實戰環節,探討如何將資料餵給模型,以及如何評估模型的好壞。


Note: 本文內容整理自「深度學習介紹」課程講義,由 AI 輔助撰寫,並經人工審核確保正確性。

Checkpoint重點複習