效能評估

認識 Machine Learning

Hadrien Lacroix

Content Developer at DataCamp

評估步驟

認識 Machine Learning

過度擬合

  • 訓練資料上表現很好
  • 測試資料上表現很差
  • 模型記住了訓練資料,無法泛化到新資料
  • 測試集檢查模型效能
認識 Machine Learning

過度擬合示意

overfitting

認識 Machine Learning

準確率

  • 準確率 = 正確分類筆數/全部筆數
  • 48 / 50 = 96%

linear classifier from first lesson

認識 Machine Learning

準確率的侷限:詐欺案例

$$

此模型的準確率:

$$\frac{28\ correctly\ classified}{30\ total\ points}=93.33\%$$

  • 漏掉多數詐欺交易
  • 需要更好的指標
認識 Machine Learning

混淆矩陣

confusion matrix

認識 Machine Learning

真陽性(True Positive)

認識 Machine Learning

真陽性(True Positive)

認識 Machine Learning

偽陰性(False Negative)

認識 Machine Learning

偽陰性(False Negative)

認識 Machine Learning

記憶訣竅:偽陰性

fp.jpg

認識 Machine Learning

把其餘欄位補滿…

認識 Machine Learning

偽陽性、真陰性

認識 Machine Learning

記憶訣竅:偽陽性

fn2.jpg

認識 Machine Learning

靈敏度(Sensitivity)

我們正確分類了多少筆詐欺交易?

$$Sensitivity = \frac{true\ positives}{true\ positives + false\ negatives} =1/3=33.33\% $$

  • 寧可把合法交易標示為可疑,也不要放行詐欺交易
認識 Machine Learning

特異度(Specificity)

$$Specificity = \frac{true\ negatives}{true\ negatives + false\ positives}$$

垃圾郵件過濾器:

  • 寧可把垃圾郵件送進收件匣,也不要把正常郵件丟進垃圾夾
認識 Machine Learning

回歸評估

認識 Machine Learning

回歸評估

  • 誤差=點(實際值)到線(預測值)的距離
  • 可用多種方法計算,例如 RMSE(均方根誤差)
認識 Machine Learning

非監督式學習

choose your own adventure

1 https://www.flickr.com/photos/micahdowty/8540188997
認識 Machine Learning

一起來練習吧!

認識 Machine Learning

Preparing Video For Download...