SlideShare a Scribd company logo
MACHINE LEARNING
YEARNING (2)
Basic Error Analysis (13 ~ 19)
Bias and Variance (20 ~ 27)
台灣人工智慧學校經理人班第二期
快快樂樂讀書分享會
James
Huang
jamescchuang@gmail.com
• 目前: 趨勢科技 專案經理
• 經歷: 軟體團隊管理與軟體開發經驗
• 產業: 系統整合業, 公共事業, 電信業,
資訊安全業
• 技術領域: 深度學習, 專案管理, 敏捷
方法, 雲端運算, 中大型網際網路應用
程式
先做出第一個版本
第一版常有改進的空間
這時候...
可是世界上沒有這麼準的 可是沒有時間做實驗了
ERROR ANALYSIS
錯誤分類 (misclassified)
錯誤標記 (mislabeled)
ERROR ANALYSIS 輔助決定優先順序
ERROR ANALYSIS
 定義:檢驗在 dev/validation set 中,被錯誤分類的樣本,
所以能更了解錯誤分類的真正原因,此流程稱為 Error
Analysis。
 量化 (quantitative) 指標輔助決策的方法。
 避免投入資源在沒有效益的方向。
 先解決最重要的問題。
 以迭代 (iterative) 的方式進行。
 也可以用同樣的方法,針對 training set 進行 error
analysis。
錯誤標記 (MISLABELED)
 在檢驗分類 (classification) 錯誤樣本的同時,也檢驗標
記錯誤 (mislabeled) 的樣本。
 最好也要同時檢驗被”正確”分類的樣本。
 修正了 dev set 的標記,也要同時修正 test set 的,以確
保 dev set 和 test set 繼續保持相同的分佈。
善用試算表來做 ERROR ANALYSIS
用統計數字來判斷那一類別的 error 影響最大
DEV SET 夠大的話
 把 Dev set 切分為
 Eyeball dev set: 人眼檢驗錯誤並修正資料
 Blackbox dev set: 透過換算法或是調參數
(hyperparameter),讓算法檢驗錯誤
如果在 Eyeball dev set 上的 performance 表現改善
優於 Blackbox dev set 的話,該回去檢視是否對
Eyeball dev set 有 overfitting 的問題
估算方式範例:
1. Error rate 是 20%, Dev set 共有 5000 筆, 總錯誤筆數是 1000
2. 想要抽 100 筆來人眼檢驗, 佔總錯誤 10%
3. 從 Dev set 中隨機抽 500 筆做為 Eyeball dev set, 剩下的 4500 為 Blackbox dev set
EYEBALL / BLACKBOX DEV SET 的 SIZE
 不管錯誤比例多少,做 Eyeball dev set 檢驗都是有幫助
的。
 如果 dev set 資料很小,就全部拿來做為 Eyeball dev
set。除了做錯誤分析之外,也可以用來做模型選擇和參
數 (hyperparameter) 調校。
 錯誤比例愈小,Eyeball dev set 就要愈大,才能有足夠
的錯誤資料來做類別分析 (做才有意義)。
EYEBALL / BLACKBOX DEV SET 的 SIZE
 如果是「人」沒有辦法做好類別分析的話,就不要有
Eyeball dev set。
 Blackbox dev set 愈大愈好?小的話也有幫助。
BIAS AND VARIANCE
(偏差和變異)
* 不等同於統計學中說的偏差與變異
加入更多資料有沒有幫助?
目標準確率 VS. 偏差 VS. 變異
 如果還差目標太多,先想改變算法
 再來做 Bias / Variance 的分析
公式:
Bias = Training Error
Variance = Dev Error (or Test Error) - Bias
EXAMPLE OF BIAS AND VARIANCE
Error Rate Bias and Variance Result Overfitting /
Training error: 1%
Dev error: 11%
Bias: 1%
Variance: 10%
High Variance Overfitting
Training error: 15%
Dev error: 16%
Bias: 15%
Variance: 1%
High Bias Underfitting
Training error: 15%
Dev error: 30%
Bias: 15%
Variance: 15%
High Bias
High Variance
Both
Training error: 0.5%
Dev error: 1%
Bias: 0.5%
Variance: 0.5%
Low Bias
Low Variance
EXAMPLE OF BIAS AND VARIANCE
OPTIMAL ERROR RATE
(UNAVOIDABLE BIAS, BAYES ERROR RATE /
BAYES RATE)
 絕對值 vs. 相對值
 Optimal error rate 可能是 Human-level Performance
Error Rate Bias and Variance Result Overfitting /
Optimal error: 14%
Training error: 15%
Dev error: 30%
Unavoidable Bias: 14%
Avoidable Bias: 1%
Variance: 15%
High
Variance
Overfitting
公式:
Bias = Optimal Error Rate + Avoidable Bias
Avoidable Bias = Optimal Error Rate - Training Error
Variance = Dev Error (or Test Error) - Bias
ADDRESSING BIAS AND VARIANCE
BIAS VS. VARIANCE TRADEOFF
Start training
High
training
error?
• Increase model size
• Modify input features based on
insights from error analysis
• Reduce or eliminate regularization
• Modify model architecture
• Add more training data
• Add regularization
• Add early stopping
• Feature selection to decrease
number/type of input features
• Decrease model size
• Modify input features based on
insights from error analysis
• Modify model architecture
Done
High dev
error?
Yes
High Bias
Yes
High Variance
No

More Related Content

Featured (20)

PDF
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
 
PDF
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
 
PDF
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
PDF
Everything You Need To Know About ChatGPT
Expeed Software
 
PDF
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
PDF
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
PDF
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
PDF
Skeleton Culture Code
Skeleton Technologies
 
PDF
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
PDF
Content Methodology: A Best Practices Report (Webinar)
contently
 
PPTX
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
PDF
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
PDF
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
PDF
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
PDF
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
PDF
Getting into the tech field. what next
Tessa Mero
 
PDF
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
PDF
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
PDF
Introduction to Data Science
Christy Abraham Joy
 
PDF
Time Management & Productivity - Best Practices
Vit Horky
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
 
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
 
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Vit Horky
 

Basic Error and Bias Variance Analysis

  • 1. MACHINE LEARNING YEARNING (2) Basic Error Analysis (13 ~ 19) Bias and Variance (20 ~ 27) 台灣人工智慧學校經理人班第二期 快快樂樂讀書分享會
  • 2. James Huang [email protected] • 目前: 趨勢科技 專案經理 • 經歷: 軟體團隊管理與軟體開發經驗 • 產業: 系統整合業, 公共事業, 電信業, 資訊安全業 • 技術領域: 深度學習, 專案管理, 敏捷 方法, 雲端運算, 中大型網際網路應用 程式
  • 8. ERROR ANALYSIS  定義:檢驗在 dev/validation set 中,被錯誤分類的樣本, 所以能更了解錯誤分類的真正原因,此流程稱為 Error Analysis。  量化 (quantitative) 指標輔助決策的方法。  避免投入資源在沒有效益的方向。  先解決最重要的問題。  以迭代 (iterative) 的方式進行。  也可以用同樣的方法,針對 training set 進行 error analysis。
  • 9. 錯誤標記 (MISLABELED)  在檢驗分類 (classification) 錯誤樣本的同時,也檢驗標 記錯誤 (mislabeled) 的樣本。  最好也要同時檢驗被”正確”分類的樣本。  修正了 dev set 的標記,也要同時修正 test set 的,以確 保 dev set 和 test set 繼續保持相同的分佈。
  • 11. DEV SET 夠大的話  把 Dev set 切分為  Eyeball dev set: 人眼檢驗錯誤並修正資料  Blackbox dev set: 透過換算法或是調參數 (hyperparameter),讓算法檢驗錯誤 如果在 Eyeball dev set 上的 performance 表現改善 優於 Blackbox dev set 的話,該回去檢視是否對 Eyeball dev set 有 overfitting 的問題 估算方式範例: 1. Error rate 是 20%, Dev set 共有 5000 筆, 總錯誤筆數是 1000 2. 想要抽 100 筆來人眼檢驗, 佔總錯誤 10% 3. 從 Dev set 中隨機抽 500 筆做為 Eyeball dev set, 剩下的 4500 為 Blackbox dev set
  • 12. EYEBALL / BLACKBOX DEV SET 的 SIZE  不管錯誤比例多少,做 Eyeball dev set 檢驗都是有幫助 的。  如果 dev set 資料很小,就全部拿來做為 Eyeball dev set。除了做錯誤分析之外,也可以用來做模型選擇和參 數 (hyperparameter) 調校。  錯誤比例愈小,Eyeball dev set 就要愈大,才能有足夠 的錯誤資料來做類別分析 (做才有意義)。
  • 13. EYEBALL / BLACKBOX DEV SET 的 SIZE  如果是「人」沒有辦法做好類別分析的話,就不要有 Eyeball dev set。  Blackbox dev set 愈大愈好?小的話也有幫助。
  • 14. BIAS AND VARIANCE (偏差和變異) * 不等同於統計學中說的偏差與變異
  • 16. 目標準確率 VS. 偏差 VS. 變異  如果還差目標太多,先想改變算法  再來做 Bias / Variance 的分析 公式: Bias = Training Error Variance = Dev Error (or Test Error) - Bias
  • 17. EXAMPLE OF BIAS AND VARIANCE Error Rate Bias and Variance Result Overfitting / Training error: 1% Dev error: 11% Bias: 1% Variance: 10% High Variance Overfitting Training error: 15% Dev error: 16% Bias: 15% Variance: 1% High Bias Underfitting Training error: 15% Dev error: 30% Bias: 15% Variance: 15% High Bias High Variance Both Training error: 0.5% Dev error: 1% Bias: 0.5% Variance: 0.5% Low Bias Low Variance
  • 18. EXAMPLE OF BIAS AND VARIANCE
  • 19. OPTIMAL ERROR RATE (UNAVOIDABLE BIAS, BAYES ERROR RATE / BAYES RATE)  絕對值 vs. 相對值  Optimal error rate 可能是 Human-level Performance Error Rate Bias and Variance Result Overfitting / Optimal error: 14% Training error: 15% Dev error: 30% Unavoidable Bias: 14% Avoidable Bias: 1% Variance: 15% High Variance Overfitting 公式: Bias = Optimal Error Rate + Avoidable Bias Avoidable Bias = Optimal Error Rate - Training Error Variance = Dev Error (or Test Error) - Bias
  • 20. ADDRESSING BIAS AND VARIANCE BIAS VS. VARIANCE TRADEOFF Start training High training error? • Increase model size • Modify input features based on insights from error analysis • Reduce or eliminate regularization • Modify model architecture • Add more training data • Add regularization • Add early stopping • Feature selection to decrease number/type of input features • Decrease model size • Modify input features based on insights from error analysis • Modify model architecture Done High dev error? Yes High Bias Yes High Variance No

Editor's Notes

  • #19: https://www.learnopencv.com/bias-variance-tradeoff-in-machine-learning/ https://liam0205.me/2017/03/25/bias-variance-tradeoff/
  • #21: 假設: data 可取得,算力無限制