泛化誤差

Machine Learning with Tree-Based Models in Python

Elie Kawerk

Data Scientist

監督式學習的運作

  • 監督式學習:$y = f(x)$,$f$ 未知。

含雜訊資料集

Machine Learning with Tree-Based Models in Python

監督式學習的目標

  • 尋找最能近似 $f$ 的模型 $\hat{f}$:$\hat{f} \approx f$

  • $\hat{f}$ 可為 Logistic Regression、Decision Tree、Neural Network…

  • 盡量排除雜訊。

  • 最終目標:$\hat{f}$ 在未見資料上有低預測誤差。

Machine Learning with Tree-Based Models in Python

近似 $f$ 的難點

  • 過度擬合

    $\hat{f}(x)$ 去擬合了訓練集的雜訊。

  • 欠擬合

    $\hat{f}$ 彈性不足,無法近似 $f$。

Machine Learning with Tree-Based Models in Python

過度擬合

過度擬合

Machine Learning with Tree-Based Models in Python

欠擬合

欠擬合

Machine Learning with Tree-Based Models in Python

泛化誤差

  • $\hat{f}$ 的泛化誤差:$\hat{f}$ 在未見資料上表現是否良好?

  • 可拆解如下:

    $\hat{f}$ 的泛化誤差 = $bias^2 + variance + \text{irreducible error}$

Machine Learning with Tree-Based Models in Python

偏差(Bias)

  • 偏差(Bias):描述平均而言 $\hat{f}$ 與 $f$ 的差距有多大。

高偏差

Machine Learning with Tree-Based Models in Python

變異(Variance)

  • 變異(Variance):描述 $\hat{f}$ 在不同訓練集上的不一致程度。

高變異

Machine Learning with Tree-Based Models in Python

模型複雜度

  • 模型複雜度:決定 $\hat{f}$ 的彈性。

  • 例如:最大樹深、每葉最少樣本數…

Machine Learning with Tree-Based Models in Python

偏差—變異權衡

泛化誤差分解

Machine Learning with Tree-Based Models in Python

偏差—變異權衡:視覺化解說

偏差—變異示意

Machine Learning with Tree-Based Models in Python

一起來練習吧!

Machine Learning with Tree-Based Models in Python

Preparing Video For Download...