SlideShare a Scribd company logo
SHapley Additive exPlanations
1. SHAP
2. Tree SHAP
1. SHAP
- 아이디어
한 obs에서 특정 Feature에 따라 Prediction 변화값을 여러 번 구하고 평균값 계산하자
1) i번째 관측치에서 feature_j의 효과를 구하자
- 예측모델 f에 feature_j 값에 따른 변화량 기록
)(ˆ)(ˆˆ 1111
ijiiij xxfxf  

k
ijkij w  ˆˆ
2) 1)을 K번 반복 후 가중평균을 계산
-> i번째 관측치에서 feature_j의 효과 (=SHAP value)
= SHAP value
1. SHAP
- Cat-forbidden(feature_j) 이 주택가격예측(Prediction)에 주는 효과?
)(ˆ)(ˆˆ 1111
ijiiij xxfxf  
- 너무 많은 Coalition Case를 어떻게 estimation 해야 할까?
-> Monte-Carlo, Kernel 등 방법 적용 중
]|)([)(ˆ
sx xxfESf 
- Coalition S = a subset of the features
1. SHAP
- Monte-Carlo method
ex. 원의 넓이를 구할 때, 사각형의 boundary를 정해준 뒤 random sampling
원 안에 점이 포함된 비율 * 사각형의 넓이 = 원의 넓이
1. SHAP
- 알고리즘 (Monte-Carlo method)
1) Require
X = Data(n x p) / x = obs / f = ML model / K = 반복 수
2) Iterations
},,1{ pj 
},,1{ Kk 
For all
For all
- Data 에서 z번째 instance random sampling
- p개의 feature를 나열하는 방법(순열) 중 하나 randomly select = ordering method
- x와 z를 ordering
- Construct two new instances
),,,,,,( 111
*
pjjj
j
zzxxxx  


),,,,,,( 111
*
pjjj
j
zzzxxx  


),,,,( 1 pjo xxxx  ),,,,( 1 pjo zzzz 
)(ˆ)(ˆˆ **)( jjk
ij xfxf 

- Calculate difference
-> ordering을 이용해 coalition 정의
2. Tree SHAP
- Ensemble Tree model의 결과를 더 잘 설명하기위한 Tree SHAP algorithms
1) Leaf-node 이면
w*v 값 반환
2) internal-node 일 때 split feature가
- coalition S 에 포함되면 threshold기준으로
좌우 중 한가지 노드 선택
- 그렇지 않으면 좌우 노드 모두 계산
단 가중치가 감소
f1
f2
f3
< 3
< 6
< 1
Coalition S = {f1, f2}
x = {2,4,6}
Score
0.9
0.1 0.3
0.2
Tree 1
1
ˆij 값 계산
2. Tree SHAP
- Weight update
m = the path of unique features we have split on so far
m의 가중치를 계속 업데이트 (EXTEND , UNWIND)
- Ensemble Tree model의 결과를 더 잘 설명하기위한 Tree SHAP algorithms
3. Output
1) Instance 별 기여도가 어떻게 구성되는지 + 전체 instance 시각화 / force_plot jupyter error
2) 전체 feature 가 model output에 어떤 영향을 미치는지 / summary_plot , sum(SHAP values)로 정렬
3. Output
- Reference
http://eehoeskrap.tistory.com/14
https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2018/1950-2018.pdf
https://christophm.github.io/interpretable-ml-book/shapley.html
https://indico.cern.ch/event/736010/contributions/3035968/attachments/1667834/2674455/14.06.18.pdf
https://dreamgonfly.github.io/2017/11/05/LIME.html
https://arxiv.org/pdf/1802.03888.pdf

More Related Content

What's hot

[DL輪読会]Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-...
[DL輪読会]Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-...[DL輪読会]Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-...
[DL輪読会]Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-...
Deep Learning JP
 
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
RAFT: Recurrent All-Pairs Field Transforms for Optical FlowRAFT: Recurrent All-Pairs Field Transforms for Optical Flow
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
MasanoriSuganuma
 
SPADE :Semantic Image Synthesis with Spatially-Adaptive Normalization
SPADE :Semantic Image Synthesis with Spatially-Adaptive NormalizationSPADE :Semantic Image Synthesis with Spatially-Adaptive Normalization
SPADE :Semantic Image Synthesis with Spatially-Adaptive Normalization
Tenki Lee
 
ポアソン画像合成
ポアソン画像合成ポアソン画像合成
ポアソン画像合成
Arumaziro
 
ICCV 2019 論文紹介 (26 papers)
ICCV 2019 論文紹介 (26 papers)ICCV 2019 論文紹介 (26 papers)
ICCV 2019 論文紹介 (26 papers)
Hideki Okada
 
画像認識の初歩、SIFT,SURF特徴量
画像認識の初歩、SIFT,SURF特徴量画像認識の初歩、SIFT,SURF特徴量
画像認識の初歩、SIFT,SURF特徴量takaya imai
 
強化学習アルゴリズムPPOの解説と実験
強化学習アルゴリズムPPOの解説と実験強化学習アルゴリズムPPOの解説と実験
強化学習アルゴリズムPPOの解説と実験
克海 納谷
 
Optuna Dashboardの紹介と設計解説 - 2022/12/10 Optuna Meetup #2
Optuna Dashboardの紹介と設計解説 - 2022/12/10 Optuna Meetup #2Optuna Dashboardの紹介と設計解説 - 2022/12/10 Optuna Meetup #2
Optuna Dashboardの紹介と設計解説 - 2022/12/10 Optuna Meetup #2
Preferred Networks
 
Trust Region Policy Optimization
Trust Region Policy OptimizationTrust Region Policy Optimization
Trust Region Policy Optimization
mooopan
 
【DL輪読会】マルチモーダル 基盤モデル
【DL輪読会】マルチモーダル 基盤モデル【DL輪読会】マルチモーダル 基盤モデル
【DL輪読会】マルチモーダル 基盤モデル
Deep Learning JP
 
GTMF 2017:IncrediBuildでビルド時間を最大90%短縮! インクレディビルドジャパン株式会社
GTMF 2017:IncrediBuildでビルド時間を最大90%短縮! インクレディビルドジャパン株式会社GTMF 2017:IncrediBuildでビルド時間を最大90%短縮! インクレディビルドジャパン株式会社
GTMF 2017:IncrediBuildでビルド時間を最大90%短縮! インクレディビルドジャパン株式会社
Game Tools & Middleware Forum
 
2値分類・多クラス分類
2値分類・多クラス分類2値分類・多クラス分類
2値分類・多クラス分類
t dev
 
強化学習入門
強化学習入門強化学習入門
強化学習入門Shunta Saito
 
【DL輪読会】Is Conditional Generative Modeling All You Need For Decision-Making?
【DL輪読会】Is Conditional Generative Modeling All You Need For Decision-Making?【DL輪読会】Is Conditional Generative Modeling All You Need For Decision-Making?
【DL輪読会】Is Conditional Generative Modeling All You Need For Decision-Making?
Deep Learning JP
 
One Class SVMを用いた異常値検知
One Class SVMを用いた異常値検知One Class SVMを用いた異常値検知
One Class SVMを用いた異常値検知
Yuto Mori
 
レコメンド研究のあれこれ
レコメンド研究のあれこれレコメンド研究のあれこれ
レコメンド研究のあれこれ
Masahiro Sato
 
ROSチュートリアル ROBOMECH2018
ROSチュートリアル ROBOMECH2018ROSチュートリアル ROBOMECH2018
ROSチュートリアル ROBOMECH2018
Ryuichi Ueda
 
東大大学院 戦略ソフトウェア特論2021「ロボットで世界を計算可能にする」海野裕也
東大大学院 戦略ソフトウェア特論2021「ロボットで世界を計算可能にする」海野裕也東大大学院 戦略ソフトウェア特論2021「ロボットで世界を計算可能にする」海野裕也
東大大学院 戦略ソフトウェア特論2021「ロボットで世界を計算可能にする」海野裕也
Preferred Networks
 
ガイデットフィルタとその周辺
ガイデットフィルタとその周辺ガイデットフィルタとその周辺
ガイデットフィルタとその周辺Norishige Fukushima
 
人工知能概論 1
人工知能概論 1人工知能概論 1
人工知能概論 1
Tadahiro Taniguchi
 

What's hot (20)

[DL輪読会]Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-...
[DL輪読会]Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-...[DL輪読会]Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-...
[DL輪読会]Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-...
 
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
RAFT: Recurrent All-Pairs Field Transforms for Optical FlowRAFT: Recurrent All-Pairs Field Transforms for Optical Flow
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
 
SPADE :Semantic Image Synthesis with Spatially-Adaptive Normalization
SPADE :Semantic Image Synthesis with Spatially-Adaptive NormalizationSPADE :Semantic Image Synthesis with Spatially-Adaptive Normalization
SPADE :Semantic Image Synthesis with Spatially-Adaptive Normalization
 
ポアソン画像合成
ポアソン画像合成ポアソン画像合成
ポアソン画像合成
 
ICCV 2019 論文紹介 (26 papers)
ICCV 2019 論文紹介 (26 papers)ICCV 2019 論文紹介 (26 papers)
ICCV 2019 論文紹介 (26 papers)
 
画像認識の初歩、SIFT,SURF特徴量
画像認識の初歩、SIFT,SURF特徴量画像認識の初歩、SIFT,SURF特徴量
画像認識の初歩、SIFT,SURF特徴量
 
強化学習アルゴリズムPPOの解説と実験
強化学習アルゴリズムPPOの解説と実験強化学習アルゴリズムPPOの解説と実験
強化学習アルゴリズムPPOの解説と実験
 
Optuna Dashboardの紹介と設計解説 - 2022/12/10 Optuna Meetup #2
Optuna Dashboardの紹介と設計解説 - 2022/12/10 Optuna Meetup #2Optuna Dashboardの紹介と設計解説 - 2022/12/10 Optuna Meetup #2
Optuna Dashboardの紹介と設計解説 - 2022/12/10 Optuna Meetup #2
 
Trust Region Policy Optimization
Trust Region Policy OptimizationTrust Region Policy Optimization
Trust Region Policy Optimization
 
【DL輪読会】マルチモーダル 基盤モデル
【DL輪読会】マルチモーダル 基盤モデル【DL輪読会】マルチモーダル 基盤モデル
【DL輪読会】マルチモーダル 基盤モデル
 
GTMF 2017:IncrediBuildでビルド時間を最大90%短縮! インクレディビルドジャパン株式会社
GTMF 2017:IncrediBuildでビルド時間を最大90%短縮! インクレディビルドジャパン株式会社GTMF 2017:IncrediBuildでビルド時間を最大90%短縮! インクレディビルドジャパン株式会社
GTMF 2017:IncrediBuildでビルド時間を最大90%短縮! インクレディビルドジャパン株式会社
 
2値分類・多クラス分類
2値分類・多クラス分類2値分類・多クラス分類
2値分類・多クラス分類
 
強化学習入門
強化学習入門強化学習入門
強化学習入門
 
【DL輪読会】Is Conditional Generative Modeling All You Need For Decision-Making?
【DL輪読会】Is Conditional Generative Modeling All You Need For Decision-Making?【DL輪読会】Is Conditional Generative Modeling All You Need For Decision-Making?
【DL輪読会】Is Conditional Generative Modeling All You Need For Decision-Making?
 
One Class SVMを用いた異常値検知
One Class SVMを用いた異常値検知One Class SVMを用いた異常値検知
One Class SVMを用いた異常値検知
 
レコメンド研究のあれこれ
レコメンド研究のあれこれレコメンド研究のあれこれ
レコメンド研究のあれこれ
 
ROSチュートリアル ROBOMECH2018
ROSチュートリアル ROBOMECH2018ROSチュートリアル ROBOMECH2018
ROSチュートリアル ROBOMECH2018
 
東大大学院 戦略ソフトウェア特論2021「ロボットで世界を計算可能にする」海野裕也
東大大学院 戦略ソフトウェア特論2021「ロボットで世界を計算可能にする」海野裕也東大大学院 戦略ソフトウェア特論2021「ロボットで世界を計算可能にする」海野裕也
東大大学院 戦略ソフトウェア特論2021「ロボットで世界を計算可能にする」海野裕也
 
ガイデットフィルタとその周辺
ガイデットフィルタとその周辺ガイデットフィルタとその周辺
ガイデットフィルタとその周辺
 
人工知能概論 1
人工知能概論 1人工知能概論 1
人工知能概論 1
 

More from suman_lim

KOOC Ch8. k-means & GMM
KOOC Ch8. k-means & GMMKOOC Ch8. k-means & GMM
KOOC Ch8. k-means & GMM
suman_lim
 
Kooc ch1 _suman
Kooc ch1 _sumanKooc ch1 _suman
Kooc ch1 _suman
suman_lim
 
Model interpretation
Model interpretationModel interpretation
Model interpretation
suman_lim
 
tsfresh_suman2
tsfresh_suman2tsfresh_suman2
tsfresh_suman2
suman_lim
 
Lightgbm_suman
Lightgbm_sumanLightgbm_suman
Lightgbm_suman
suman_lim
 
Boosting_suman
Boosting_sumanBoosting_suman
Boosting_suman
suman_lim
 

More from suman_lim (6)

KOOC Ch8. k-means & GMM
KOOC Ch8. k-means & GMMKOOC Ch8. k-means & GMM
KOOC Ch8. k-means & GMM
 
Kooc ch1 _suman
Kooc ch1 _sumanKooc ch1 _suman
Kooc ch1 _suman
 
Model interpretation
Model interpretationModel interpretation
Model interpretation
 
tsfresh_suman2
tsfresh_suman2tsfresh_suman2
tsfresh_suman2
 
Lightgbm_suman
Lightgbm_sumanLightgbm_suman
Lightgbm_suman
 
Boosting_suman
Boosting_sumanBoosting_suman
Boosting_suman
 

Shap