SlideShare a Scribd company logo
Behind The Black BoX:
How To Understand Any Ml Model Using SHAP
Welcome!
I am Jonathan Bechtel
- MS Analytics @ Georgia Tech
- Head Data Science Instructor @
General Assembly
- Private Consultant To Help
Companies Work Through Data
Projects
- Learn More About Me:
www.jonathanbech.tel
2
Our Agenda
⊹ Describe A Problem: The tension between
model accuracy and interpretability
⊹ Study A Solution: Shapley sampling and its
ability to describe any model’s prediction
⊹ Learn New Software: Take a deep dive into
the SHAP library and its different uses
⊹ Get Hands On Practice: We’ll have small
breaks for knowledge checks & coding practice
3
Model Interpretability:
The Fundamental Tradeoff
1
Simple Models
- Less accurate
- Extract shallow
patterns from data
- Generate model
interpretations that are
straightforward
Accuracy Vs. Interpretability
Complicated Models
- More accurate
- Extract perceptual,
non-linear patterns
- No straightforward
way to map how inputs
contribute to output
5
Simple Models
- Linear Regression
- Logistic Regression
- Naïve Bayes
- Exponential Smoothing
Accuracy Vs. Interpretability
Complicated Models
- Neural Networks
- Tree Based Ensembles:
- Random Forests
- Gradient Boosting
Machines
6
The Case For Complicated Models
The emergence of large datasets and cheap compute power has
made the enhanced pattern recognition capabilities of complicated
models more practical and relevant than ever before
7
Case In Point: An Empirical Comparison of
Supervised Learning Algorithms Using
Different Performance Metrics
8
https://bit.ly/3b8b1ug
8 Datasets
Testing Different Classification Problems
30 Different models
From Linear Models to Deep Neural Networks
9 Metrics
To Capture Different Aspects of Model Performance
9
10
But They Are Often Underused….
Because they lack an easy way to be understood by people who
need to use their outputs in decision making
Simpler models are often used as substitutes because they have
methods of explanation that are more tractable, despite their faults
11
12
Understanding Black Box
Models:
An Ongoing Struggle
2
14
Feature Importance Has Major
shortcomings
What direction does each
feature impact the model in?
What impact do individual
values have on the model?
What direction does each
feature Move the model?
How do model features
impact a prediction at a local
level?
How do individual values
impact the model?
How do model features impact a
prediction at a local level?
15
Simple Models
Model
Prediction
Explanation
Complicated Models
Model
Prediction
ExplanatoryModel(Model)
Explanation
Complicated models need a separate model to
study the relationship between their inputs and
outputs
What Properties Should A Model Explainer
have?
16
1 2 3
17
1). Start with your base prediction
2). Add up the
contributions of
all of your
features
3). And that should
add up to your model’s
final prediction
Local Accuracy
For live demonstration: https://bit.ly/policexray
18
Missingness
Since the contribution
of the Quarter
column is 0,
removing it should
not impact the
model’s prediction
For live demonstration: https://bit.ly/policexray
19
Consistency
Since we increased
the value of Age from
40 to 50 and held
everything else
constant, its
contribution should not
decrease
For live demonstration: https://bit.ly/policexray
Shapley
Additive
exPlanation
A Unified Way to Understand Any Model
3
21
SHAP is a method for deriving the contributions of
individual factors for any model
Its Main Parts:
Game Theory
How do players in a game collaborate with one another to achieve
payouts for their contributions?
Permutation
Selectively changing the arrangement of items in a system to measure
their impact against one another.
22
Wither Game Theory?
Every
column is a
‘participant’
in the game
The ‘prize’
they are
competing
for is the
model’s
prediction
23
Wither Game Theory?
The contribution
of each feature
to a prediction is
the ‘payout’ they
receive for their
efforts
24
Permutation
Sample 1 Sample 2 FrankenSample1 FrankenSample2
Values from
sample 1
Values from
sample 2
Values from RM column deliberately kept different
25
Permutation
By repeatedly shuffling different combinations of columns from
different samples and deliberately holding one value separate between
them, we can eventually find the expected contribution of each column
for a particular value in a model by Averaging differences
In their predictions
26
Please visit the link at
https://bit.ly/shapley_sampling to
continue!
27
Why We like Shapley Sampling
Values
- They satisfy the model explanation criteria: local
accuracy, missingness, and consistency
- They are model agnostic: they work regardless of the type of
model you use
- They capture interaction effects: always compare change of
a single value against a random combination of others
28
Why We don’t like Shapley
Sampling Values
- They’re expensive: calculating every shapley value for every
single combination of columns for every sample scales in 2k! time
- Don’t scale for certain models: could you calculate a
shapley value for every pixel in an image? No, probably not
- They require access to your data: you must be able to
examine your training set extensively in order to derive them
29
Shap
Deep
Shap
Tree
Shap
Kernel
Shap
Shapley
Sampling
LIME
The SHAP technique
couples the benefits
of shapley sampling
with performant
methods of
understanding
specific models
“ The SHAP framework identifies the class
of additive feature importance methods
(which includes six previous methods)
and shows there is a unique solution in
this class that adheres to desirable
properties.
- Scott Lundberg, “A Unified Approach to Interpreting Model
Preditions”, https://bit.ly/shap_paper
30
31
Please visit the link at
https://bit.ly/shap_demo to
continue!
Different
applications for shap
3
33
Interaction Effects
If called on, SHAP can decompose a SHAP value into its
independent effect, and the contributing effect of each of the
individual columns that contributed to it
Example Shap value for RM: 6.4
6.4 = 7.3 – 2.4 + 4.6 – 3.1
Total Main LSTAT CRIM TAX
Value Effect Effect Effect Effect
34
Example Interaction Matrix for one sample
Independent effect of a
column’s shap value across
the diagonal
Contributing effect of each
additional column for that
shap value
Add up the values in each
row to get the total shap
value for that column
35
Low values of LSTAT counteract the
impact of high RM
RM and TAX are functionally
independent
36
Classification
exp(-3.294) = .037 = model prediction
exp(-3.294) = .037 = model prediction
37
Deep Learning
SHAP uses the DeepLift algorithm to allow for the
computation of shapley values in a way that is well suited for
different types of neural networks
This means out-of-the-box functionality for image classifiers
with convolutional neural networks and language models with
transformers
38
SHAP + Deep Learning
Impact of removing individual words on weight
vectors associated with them
Impact of removing individual words on Resulting
model probability
Final Points
40
Model Inference Causal Inference
SHAP values tell you about patterns inside your
data, but do not provide a genuine counterfactual
Shap is two tools wrapped up in one
Computational
A fast and exact way
to calculate shapley
values for a wide
variety of models
Graphing
Helpful charts that
use matplotlib to
make shap values
more digestible
41
It is perfectly fine to use shap for any combination of these
as suits your needs
Sometimes the graphing section can be a little buggy:
- Inconsistent support for different models
- No pytorch support yet
Despite some limitations and bugs, shap has
quickly established itself as the most widely
used tool for interpretable ml
42
In Approximately 2 Years:
14, 400
Github Stars
2,200
Forks
Extra Resources
Because Learning Is Fun
2
44
Useful Links
Main github repo: https://github.com/slundberg/shap
Original paper: https://arxiv.org/abs/1705.07874
Paper for TreeShap: https://arxiv.org/abs/1905.04610
Useful reading for interpretable ML: https://christophm.github.io/interpretable-ml-book/
Kaggle course: https://www.kaggle.com/dansbecker/shap-values
Live production example of shap: https://www.policexray.com/home/ (disclosure: I wrote it)
Thanks!
Any questions?
You can find me at:
⊹ jonathan@jonathanbech.tel
⊹ www.jonathanbech.tel
45

More Related Content

What's hot

DC02. Interpretation of predictions
DC02. Interpretation of predictionsDC02. Interpretation of predictions
DC02. Interpretation of predictions
Anton Kulesh
 
Explainability and bias in AI
Explainability and bias in AIExplainability and bias in AI
Explainability and bias in AI
Bill Liu
 
DataRobotによる予測モデルを用いた シミュレーションと最適化(抜粋)
DataRobotによる予測モデルを用いた シミュレーションと最適化(抜粋)DataRobotによる予測モデルを用いた シミュレーションと最適化(抜粋)
DataRobotによる予測モデルを用いた シミュレーションと最適化(抜粋)
Yuya Yamamoto
 
BlackBox モデルの説明性・解釈性技術の実装
BlackBox モデルの説明性・解釈性技術の実装BlackBox モデルの説明性・解釈性技術の実装
BlackBox モデルの説明性・解釈性技術の実装
Deep Learning Lab(ディープラーニング・ラボ)
 
Jsai
JsaiJsai
機械学習を使った時系列売上予測
機械学習を使った時系列売上予測機械学習を使った時系列売上予測
機械学習を使った時系列売上予測
DataRobotJP
 
Shap
ShapShap
Explainable Machine Learning (Explainable ML)
Explainable Machine Learning (Explainable ML)Explainable Machine Learning (Explainable ML)
Explainable Machine Learning (Explainable ML)
Hayim Makabee
 
深層ニューラルネットワークの積分表現(Deepを定式化する数学)
深層ニューラルネットワークの積分表現(Deepを定式化する数学)深層ニューラルネットワークの積分表現(Deepを定式化する数学)
深層ニューラルネットワークの積分表現(Deepを定式化する数学)
Katsuya Ito
 
ICML 2020 最適輸送まとめ
ICML 2020 最適輸送まとめICML 2020 最適輸送まとめ
ICML 2020 最適輸送まとめ
ohken
 
Explainable AI
Explainable AIExplainable AI
Explainable AI
Arithmer Inc.
 
Convolutional Neural Networks : Popular Architectures
Convolutional Neural Networks : Popular ArchitecturesConvolutional Neural Networks : Popular Architectures
Convolutional Neural Networks : Popular Architectures
ananth
 
ファクター投資と機械学習
ファクター投資と機械学習ファクター投資と機械学習
ファクター投資と機械学習
Kei Nakagawa
 
Data-Centric AIの紹介
Data-Centric AIの紹介Data-Centric AIの紹介
Data-Centric AIの紹介
Kazuyuki Miyazawa
 
[DL輪読会]A Hierarchical Latent Vector Model for Learning Long-Term Structure in...
[DL輪読会]A Hierarchical Latent Vector Model for Learning Long-Term Structure in...[DL輪読会]A Hierarchical Latent Vector Model for Learning Long-Term Structure in...
[DL輪読会]A Hierarchical Latent Vector Model for Learning Long-Term Structure in...
Deep Learning JP
 
Active Learning と Bayesian Neural Network
Active Learning と Bayesian Neural NetworkActive Learning と Bayesian Neural Network
Active Learning と Bayesian Neural Network
Naoki Matsunaga
 
Explainable AI (XAI) - A Perspective
Explainable AI (XAI) - A Perspective Explainable AI (XAI) - A Perspective
Explainable AI (XAI) - A Perspective
Saurabh Kaushik
 
GARCHSKモデルを用いた条件付き固有モーメントの実証分析
GARCHSKモデルを用いた条件付き固有モーメントの実証分析GARCHSKモデルを用いた条件付き固有モーメントの実証分析
GARCHSKモデルを用いた条件付き固有モーメントの実証分析
Kei Nakagawa
 
Intepretability / Explainable AI for Deep Neural Networks
Intepretability / Explainable AI for Deep Neural NetworksIntepretability / Explainable AI for Deep Neural Networks
Intepretability / Explainable AI for Deep Neural Networks
Universitat Politècnica de Catalunya
 
勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)
勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)
勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)
RyuichiKanoh
 

What's hot (20)

DC02. Interpretation of predictions
DC02. Interpretation of predictionsDC02. Interpretation of predictions
DC02. Interpretation of predictions
 
Explainability and bias in AI
Explainability and bias in AIExplainability and bias in AI
Explainability and bias in AI
 
DataRobotによる予測モデルを用いた シミュレーションと最適化(抜粋)
DataRobotによる予測モデルを用いた シミュレーションと最適化(抜粋)DataRobotによる予測モデルを用いた シミュレーションと最適化(抜粋)
DataRobotによる予測モデルを用いた シミュレーションと最適化(抜粋)
 
BlackBox モデルの説明性・解釈性技術の実装
BlackBox モデルの説明性・解釈性技術の実装BlackBox モデルの説明性・解釈性技術の実装
BlackBox モデルの説明性・解釈性技術の実装
 
Jsai
JsaiJsai
Jsai
 
機械学習を使った時系列売上予測
機械学習を使った時系列売上予測機械学習を使った時系列売上予測
機械学習を使った時系列売上予測
 
Shap
ShapShap
Shap
 
Explainable Machine Learning (Explainable ML)
Explainable Machine Learning (Explainable ML)Explainable Machine Learning (Explainable ML)
Explainable Machine Learning (Explainable ML)
 
深層ニューラルネットワークの積分表現(Deepを定式化する数学)
深層ニューラルネットワークの積分表現(Deepを定式化する数学)深層ニューラルネットワークの積分表現(Deepを定式化する数学)
深層ニューラルネットワークの積分表現(Deepを定式化する数学)
 
ICML 2020 最適輸送まとめ
ICML 2020 最適輸送まとめICML 2020 最適輸送まとめ
ICML 2020 最適輸送まとめ
 
Explainable AI
Explainable AIExplainable AI
Explainable AI
 
Convolutional Neural Networks : Popular Architectures
Convolutional Neural Networks : Popular ArchitecturesConvolutional Neural Networks : Popular Architectures
Convolutional Neural Networks : Popular Architectures
 
ファクター投資と機械学習
ファクター投資と機械学習ファクター投資と機械学習
ファクター投資と機械学習
 
Data-Centric AIの紹介
Data-Centric AIの紹介Data-Centric AIの紹介
Data-Centric AIの紹介
 
[DL輪読会]A Hierarchical Latent Vector Model for Learning Long-Term Structure in...
[DL輪読会]A Hierarchical Latent Vector Model for Learning Long-Term Structure in...[DL輪読会]A Hierarchical Latent Vector Model for Learning Long-Term Structure in...
[DL輪読会]A Hierarchical Latent Vector Model for Learning Long-Term Structure in...
 
Active Learning と Bayesian Neural Network
Active Learning と Bayesian Neural NetworkActive Learning と Bayesian Neural Network
Active Learning と Bayesian Neural Network
 
Explainable AI (XAI) - A Perspective
Explainable AI (XAI) - A Perspective Explainable AI (XAI) - A Perspective
Explainable AI (XAI) - A Perspective
 
GARCHSKモデルを用いた条件付き固有モーメントの実証分析
GARCHSKモデルを用いた条件付き固有モーメントの実証分析GARCHSKモデルを用いた条件付き固有モーメントの実証分析
GARCHSKモデルを用いた条件付き固有モーメントの実証分析
 
Intepretability / Explainable AI for Deep Neural Networks
Intepretability / Explainable AI for Deep Neural NetworksIntepretability / Explainable AI for Deep Neural Networks
Intepretability / Explainable AI for Deep Neural Networks
 
勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)
勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)
勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)
 

Similar to Understanding Black Box Models with Shapley Values

A Unified Approach to Interpreting Model Predictions (SHAP)
A Unified Approach to Interpreting Model Predictions (SHAP)A Unified Approach to Interpreting Model Predictions (SHAP)
A Unified Approach to Interpreting Model Predictions (SHAP)
Rama Irsheidat
 
Interpretable ML
Interpretable MLInterpretable ML
Interpretable ML
Mayur Sand
 
C3 w5
C3 w5C3 w5
Shapley Tech Talk - SHAP and Shapley Discussion
Shapley Tech Talk - SHAP and Shapley DiscussionShapley Tech Talk - SHAP and Shapley Discussion
Shapley Tech Talk - SHAP and Shapley Discussion
Tushar Tank
 
Steering Model Selection with Visual Diagnostics
Steering Model Selection with Visual DiagnosticsSteering Model Selection with Visual Diagnostics
Steering Model Selection with Visual Diagnostics
Melissa Moody
 
WIA 2019 - Steering Model Selection with Visual Diagnostics
WIA 2019 - Steering Model Selection with Visual DiagnosticsWIA 2019 - Steering Model Selection with Visual Diagnostics
WIA 2019 - Steering Model Selection with Visual Diagnostics
Women in Analytics Conference
 
Steering Model Selection with Visual Diagnostics: Women in Analytics 2019
Steering Model Selection with Visual Diagnostics: Women in Analytics 2019Steering Model Selection with Visual Diagnostics: Women in Analytics 2019
Steering Model Selection with Visual Diagnostics: Women in Analytics 2019
Rebecca Bilbro
 
STAT7440StudentIMLPresentationJishan.pptx
STAT7440StudentIMLPresentationJishan.pptxSTAT7440StudentIMLPresentationJishan.pptx
STAT7440StudentIMLPresentationJishan.pptx
JishanAhmed24
 
ODSC APAC 2022 - Explainable AI
ODSC APAC 2022 - Explainable AIODSC APAC 2022 - Explainable AI
ODSC APAC 2022 - Explainable AI
Aditya Bhattacharya
 
Responsible AI in Industry: Practical Challenges and Lessons Learned
Responsible AI in Industry: Practical Challenges and Lessons LearnedResponsible AI in Industry: Practical Challenges and Lessons Learned
Responsible AI in Industry: Practical Challenges and Lessons Learned
Krishnaram Kenthapadi
 
Explainable AI - making ML and DL models more interpretable
Explainable AI - making ML and DL models more interpretableExplainable AI - making ML and DL models more interpretable
Explainable AI - making ML and DL models more interpretable
Aditya Bhattacharya
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
Alluxio, Inc.
 
An Introduction to XAI! Towards Trusting Your ML Models!
An Introduction to XAI! Towards Trusting Your ML Models!An Introduction to XAI! Towards Trusting Your ML Models!
An Introduction to XAI! Towards Trusting Your ML Models!
Mansour Saffar
 
Towards Human-Centered Machine Learning
Towards Human-Centered Machine LearningTowards Human-Centered Machine Learning
Towards Human-Centered Machine Learning
Sri Ambati
 
Improving Machine Learning using Graph Algorithms
Improving Machine Learning using Graph AlgorithmsImproving Machine Learning using Graph Algorithms
Improving Machine Learning using Graph Algorithms
Neo4j
 
Overfitting & Underfitting
Overfitting & UnderfittingOverfitting & Underfitting
Overfitting & Underfitting
SOUMIT KAR
 
ML-Unit-4.pdf
ML-Unit-4.pdfML-Unit-4.pdf
ML-Unit-4.pdf
AnushaSharma81
 
Machine Learning Explainability.pptx
Machine Learning Explainability.pptxMachine Learning Explainability.pptx
Machine Learning Explainability.pptx
ShehnazIslam1
 
The importance of model fairness and interpretability in AI systems
The importance of model fairness and interpretability in AI systemsThe importance of model fairness and interpretability in AI systems
The importance of model fairness and interpretability in AI systems
Francesca Lazzeri, PhD
 
PR-231: A Simple Framework for Contrastive Learning of Visual Representations
PR-231: A Simple Framework for Contrastive Learning of Visual RepresentationsPR-231: A Simple Framework for Contrastive Learning of Visual Representations
PR-231: A Simple Framework for Contrastive Learning of Visual Representations
Jinwon Lee
 

Similar to Understanding Black Box Models with Shapley Values (20)

A Unified Approach to Interpreting Model Predictions (SHAP)
A Unified Approach to Interpreting Model Predictions (SHAP)A Unified Approach to Interpreting Model Predictions (SHAP)
A Unified Approach to Interpreting Model Predictions (SHAP)
 
Interpretable ML
Interpretable MLInterpretable ML
Interpretable ML
 
C3 w5
C3 w5C3 w5
C3 w5
 
Shapley Tech Talk - SHAP and Shapley Discussion
Shapley Tech Talk - SHAP and Shapley DiscussionShapley Tech Talk - SHAP and Shapley Discussion
Shapley Tech Talk - SHAP and Shapley Discussion
 
Steering Model Selection with Visual Diagnostics
Steering Model Selection with Visual DiagnosticsSteering Model Selection with Visual Diagnostics
Steering Model Selection with Visual Diagnostics
 
WIA 2019 - Steering Model Selection with Visual Diagnostics
WIA 2019 - Steering Model Selection with Visual DiagnosticsWIA 2019 - Steering Model Selection with Visual Diagnostics
WIA 2019 - Steering Model Selection with Visual Diagnostics
 
Steering Model Selection with Visual Diagnostics: Women in Analytics 2019
Steering Model Selection with Visual Diagnostics: Women in Analytics 2019Steering Model Selection with Visual Diagnostics: Women in Analytics 2019
Steering Model Selection with Visual Diagnostics: Women in Analytics 2019
 
STAT7440StudentIMLPresentationJishan.pptx
STAT7440StudentIMLPresentationJishan.pptxSTAT7440StudentIMLPresentationJishan.pptx
STAT7440StudentIMLPresentationJishan.pptx
 
ODSC APAC 2022 - Explainable AI
ODSC APAC 2022 - Explainable AIODSC APAC 2022 - Explainable AI
ODSC APAC 2022 - Explainable AI
 
Responsible AI in Industry: Practical Challenges and Lessons Learned
Responsible AI in Industry: Practical Challenges and Lessons LearnedResponsible AI in Industry: Practical Challenges and Lessons Learned
Responsible AI in Industry: Practical Challenges and Lessons Learned
 
Explainable AI - making ML and DL models more interpretable
Explainable AI - making ML and DL models more interpretableExplainable AI - making ML and DL models more interpretable
Explainable AI - making ML and DL models more interpretable
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
An Introduction to XAI! Towards Trusting Your ML Models!
An Introduction to XAI! Towards Trusting Your ML Models!An Introduction to XAI! Towards Trusting Your ML Models!
An Introduction to XAI! Towards Trusting Your ML Models!
 
Towards Human-Centered Machine Learning
Towards Human-Centered Machine LearningTowards Human-Centered Machine Learning
Towards Human-Centered Machine Learning
 
Improving Machine Learning using Graph Algorithms
Improving Machine Learning using Graph AlgorithmsImproving Machine Learning using Graph Algorithms
Improving Machine Learning using Graph Algorithms
 
Overfitting & Underfitting
Overfitting & UnderfittingOverfitting & Underfitting
Overfitting & Underfitting
 
ML-Unit-4.pdf
ML-Unit-4.pdfML-Unit-4.pdf
ML-Unit-4.pdf
 
Machine Learning Explainability.pptx
Machine Learning Explainability.pptxMachine Learning Explainability.pptx
Machine Learning Explainability.pptx
 
The importance of model fairness and interpretability in AI systems
The importance of model fairness and interpretability in AI systemsThe importance of model fairness and interpretability in AI systems
The importance of model fairness and interpretability in AI systems
 
PR-231: A Simple Framework for Contrastive Learning of Visual Representations
PR-231: A Simple Framework for Contrastive Learning of Visual RepresentationsPR-231: A Simple Framework for Contrastive Learning of Visual Representations
PR-231: A Simple Framework for Contrastive Learning of Visual Representations
 

Recently uploaded

一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
xclpvhuk
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
Sachin Paul
 
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
apvysm8
 
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
bopyb
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
Timothy Spann
 
Experts live - Improving user adoption with AI
Experts live - Improving user adoption with AIExperts live - Improving user adoption with AI
Experts live - Improving user adoption with AI
jitskeb
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
Social Samosa
 
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Aggregage
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
aqzctr7x
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
Timothy Spann
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
nuttdpt
 
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
v7oacc3l
 
Analysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performanceAnalysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performance
roli9797
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
Lars Albertsson
 
Learn SQL from basic queries to Advance queries
Learn SQL from basic queries to Advance queriesLearn SQL from basic queries to Advance queries
Learn SQL from basic queries to Advance queries
manishkhaire30
 
Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...
Bill641377
 
Global Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headedGlobal Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headed
vikram sood
 
Challenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more importantChallenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more important
Sm321
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
Social Samosa
 
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
wyddcwye1
 

Recently uploaded (20)

一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
 
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
 
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
 
Experts live - Improving user adoption with AI
Experts live - Improving user adoption with AIExperts live - Improving user adoption with AI
Experts live - Improving user adoption with AI
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
 
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
 
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
 
Analysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performanceAnalysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performance
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
 
Learn SQL from basic queries to Advance queries
Learn SQL from basic queries to Advance queriesLearn SQL from basic queries to Advance queries
Learn SQL from basic queries to Advance queries
 
Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...
 
Global Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headedGlobal Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headed
 
Challenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more importantChallenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more important
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
 
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
原版一比一利兹贝克特大学毕业证(LeedsBeckett毕业证书)如何办理
 

Understanding Black Box Models with Shapley Values

  • 1. Behind The Black BoX: How To Understand Any Ml Model Using SHAP
  • 2. Welcome! I am Jonathan Bechtel - MS Analytics @ Georgia Tech - Head Data Science Instructor @ General Assembly - Private Consultant To Help Companies Work Through Data Projects - Learn More About Me: www.jonathanbech.tel 2
  • 3. Our Agenda ⊹ Describe A Problem: The tension between model accuracy and interpretability ⊹ Study A Solution: Shapley sampling and its ability to describe any model’s prediction ⊹ Learn New Software: Take a deep dive into the SHAP library and its different uses ⊹ Get Hands On Practice: We’ll have small breaks for knowledge checks & coding practice 3
  • 5. Simple Models - Less accurate - Extract shallow patterns from data - Generate model interpretations that are straightforward Accuracy Vs. Interpretability Complicated Models - More accurate - Extract perceptual, non-linear patterns - No straightforward way to map how inputs contribute to output 5
  • 6. Simple Models - Linear Regression - Logistic Regression - Naïve Bayes - Exponential Smoothing Accuracy Vs. Interpretability Complicated Models - Neural Networks - Tree Based Ensembles: - Random Forests - Gradient Boosting Machines 6
  • 7. The Case For Complicated Models The emergence of large datasets and cheap compute power has made the enhanced pattern recognition capabilities of complicated models more practical and relevant than ever before 7
  • 8. Case In Point: An Empirical Comparison of Supervised Learning Algorithms Using Different Performance Metrics 8 https://bit.ly/3b8b1ug
  • 9. 8 Datasets Testing Different Classification Problems 30 Different models From Linear Models to Deep Neural Networks 9 Metrics To Capture Different Aspects of Model Performance 9
  • 10. 10
  • 11. But They Are Often Underused…. Because they lack an easy way to be understood by people who need to use their outputs in decision making Simpler models are often used as substitutes because they have methods of explanation that are more tractable, despite their faults 11
  • 12. 12
  • 14. 14 Feature Importance Has Major shortcomings What direction does each feature impact the model in? What impact do individual values have on the model? What direction does each feature Move the model? How do model features impact a prediction at a local level? How do individual values impact the model? How do model features impact a prediction at a local level?
  • 15. 15 Simple Models Model Prediction Explanation Complicated Models Model Prediction ExplanatoryModel(Model) Explanation Complicated models need a separate model to study the relationship between their inputs and outputs
  • 16. What Properties Should A Model Explainer have? 16 1 2 3
  • 17. 17 1). Start with your base prediction 2). Add up the contributions of all of your features 3). And that should add up to your model’s final prediction Local Accuracy For live demonstration: https://bit.ly/policexray
  • 18. 18 Missingness Since the contribution of the Quarter column is 0, removing it should not impact the model’s prediction For live demonstration: https://bit.ly/policexray
  • 19. 19 Consistency Since we increased the value of Age from 40 to 50 and held everything else constant, its contribution should not decrease For live demonstration: https://bit.ly/policexray
  • 20. Shapley Additive exPlanation A Unified Way to Understand Any Model 3
  • 21. 21 SHAP is a method for deriving the contributions of individual factors for any model Its Main Parts: Game Theory How do players in a game collaborate with one another to achieve payouts for their contributions? Permutation Selectively changing the arrangement of items in a system to measure their impact against one another.
  • 22. 22 Wither Game Theory? Every column is a ‘participant’ in the game The ‘prize’ they are competing for is the model’s prediction
  • 23. 23 Wither Game Theory? The contribution of each feature to a prediction is the ‘payout’ they receive for their efforts
  • 24. 24 Permutation Sample 1 Sample 2 FrankenSample1 FrankenSample2 Values from sample 1 Values from sample 2 Values from RM column deliberately kept different
  • 25. 25 Permutation By repeatedly shuffling different combinations of columns from different samples and deliberately holding one value separate between them, we can eventually find the expected contribution of each column for a particular value in a model by Averaging differences In their predictions
  • 26. 26 Please visit the link at https://bit.ly/shapley_sampling to continue!
  • 27. 27 Why We like Shapley Sampling Values - They satisfy the model explanation criteria: local accuracy, missingness, and consistency - They are model agnostic: they work regardless of the type of model you use - They capture interaction effects: always compare change of a single value against a random combination of others
  • 28. 28 Why We don’t like Shapley Sampling Values - They’re expensive: calculating every shapley value for every single combination of columns for every sample scales in 2k! time - Don’t scale for certain models: could you calculate a shapley value for every pixel in an image? No, probably not - They require access to your data: you must be able to examine your training set extensively in order to derive them
  • 29. 29 Shap Deep Shap Tree Shap Kernel Shap Shapley Sampling LIME The SHAP technique couples the benefits of shapley sampling with performant methods of understanding specific models
  • 30. “ The SHAP framework identifies the class of additive feature importance methods (which includes six previous methods) and shows there is a unique solution in this class that adheres to desirable properties. - Scott Lundberg, “A Unified Approach to Interpreting Model Preditions”, https://bit.ly/shap_paper 30
  • 31. 31 Please visit the link at https://bit.ly/shap_demo to continue!
  • 33. 33 Interaction Effects If called on, SHAP can decompose a SHAP value into its independent effect, and the contributing effect of each of the individual columns that contributed to it Example Shap value for RM: 6.4 6.4 = 7.3 – 2.4 + 4.6 – 3.1 Total Main LSTAT CRIM TAX Value Effect Effect Effect Effect
  • 34. 34 Example Interaction Matrix for one sample Independent effect of a column’s shap value across the diagonal Contributing effect of each additional column for that shap value Add up the values in each row to get the total shap value for that column
  • 35. 35 Low values of LSTAT counteract the impact of high RM RM and TAX are functionally independent
  • 36. 36 Classification exp(-3.294) = .037 = model prediction exp(-3.294) = .037 = model prediction
  • 37. 37 Deep Learning SHAP uses the DeepLift algorithm to allow for the computation of shapley values in a way that is well suited for different types of neural networks This means out-of-the-box functionality for image classifiers with convolutional neural networks and language models with transformers
  • 38. 38 SHAP + Deep Learning Impact of removing individual words on weight vectors associated with them Impact of removing individual words on Resulting model probability
  • 40. 40 Model Inference Causal Inference SHAP values tell you about patterns inside your data, but do not provide a genuine counterfactual
  • 41. Shap is two tools wrapped up in one Computational A fast and exact way to calculate shapley values for a wide variety of models Graphing Helpful charts that use matplotlib to make shap values more digestible 41 It is perfectly fine to use shap for any combination of these as suits your needs Sometimes the graphing section can be a little buggy: - Inconsistent support for different models - No pytorch support yet
  • 42. Despite some limitations and bugs, shap has quickly established itself as the most widely used tool for interpretable ml 42 In Approximately 2 Years: 14, 400 Github Stars 2,200 Forks
  • 44. 44 Useful Links Main github repo: https://github.com/slundberg/shap Original paper: https://arxiv.org/abs/1705.07874 Paper for TreeShap: https://arxiv.org/abs/1905.04610 Useful reading for interpretable ML: https://christophm.github.io/interpretable-ml-book/ Kaggle course: https://www.kaggle.com/dansbecker/shap-values Live production example of shap: https://www.policexray.com/home/ (disclosure: I wrote it)
  • 45. Thanks! Any questions? You can find me at: ⊹ jonathan@jonathanbech.tel ⊹ www.jonathanbech.tel 45