Upgrade to Pro — share decks privately, control downloads, hide ads and more …

InterpretMLと Explainable Boosting Machineのススメ

JDSC
March 18, 2021
1.9k

InterpretMLと Explainable Boosting Machineのススメ

JDSC社内DS勉強会のスライドです。

JDSC

March 18, 2021
Tweet

Transcript

  1. Table of contents 1. Intro 2. interpretMLの紹介 3. interpretML demo

    4. Explainable Boosting Machine(EBM)の紹介 5. EBMの性能評価 vsLGBM
  2. 単に予測を得るだけでは不十分な問題もある The need for interpretability arises from an incompleteness in

    problem formalization (Doshi-Velez and Kim 2017), which means that for certain problems or tasks it is not enough to get the prediction (the what). The model must also explain how it came to the prediction (the why), because a correct prediction only partially solves your original problem. https://christophm.github.io/interpretable-ml-book/interpretability-importance.html
  3. Interpretability methodsに関する色々な分類(1) Intrinsic or Post hoc Result of the interpretation

    method Model-specific or model-agnostic Local or global 色々な分類があるがあまり整理されていない印象 https://christophm.github.io/interpretable-ml-book/taxonomy-of-interpretability-methods.html 本質的にモデルに備わっている性質として説明性があるのか(決定木とか) モデルをTrainしたあとに何かしらの手法を適用するものか(Permutation feature importanceとか) どのような形式で結果を受け取るか 例)Feature summary stats / Feature summary visualization / Model internals / Data point / Intrinsically interpretable model 特定のモデルにしか使えない手法か、汎用的に使えるか Intrinsic or post hocとほぼ同義 特定個体の予測に対しての説明を提供するのか、モデル全体の振る舞いを説 明するのか、その間か
  4. Interpretability methodsに関する色々な分類(2) Analyzing Components of Interpretable Models Analyzing Components of

    More Complex Models Explaining Individual Predictions Explaining Global Model Behavior Interpretable Machine Learning – A Brief History, State-of-the-Art and Challenges https://arxiv.org/pdf/2010.09337.pdf 解釈可能性の高いシンプルなモデルを使う(線形回帰、決定木、ルールベース) 高次元になったり枝が深くなると結局解釈が難しくなる→LASSOなど 複雑なモデルを使いつつ、その内部構造に注目 CNNの隠れ層を可視化したり、random forestのGini importance出したり 個々の予測値に対して各特徴量がどのような影響を与えるのかを定量化 SHAP(shapley値)とか、DiCE(counterfactual explanations)とか 各特徴量がモデル全体の予測にどれくらい影響を与えているかを定量化する Permutation Importanceとか Surrogate Models 説明したいモデルの振る舞いを、別の解釈可能なモデルで学習する 例えばDNNの出力を決定木で学習させて、決定木のロジックを説明に使うなど LIMEもこのパターン(似ているデータで局所線形回帰を作る)
  5. interpretML is何 • 概要 • Microsoftが出している機械学習モデルを解釈可能とするためのOSS Package(Python/R) • 多分2017年位からあるが未だにOSS版はalpha release

    • ドキュメントが薄いというか紙なので、実装を見ながら使うしかない • Azure Machine Learning版もあり、こちらの方がメンテされている (https://docs.microsoft.com/ja-jp/azure/machine-learning/how-to-machine-learning-interpretability ) • 主な機能 • SHAPやLIMEなど様々なmodel-agnosticな手法に対して統一的な Interfaceを提供 • GBDT並の精度と解釈可能性を誇るGA2Mの高速な実装、EBMが使える
  6. InterpretMLのまとめ • 設計思想はよい • いろいろな解釈手法を統一的なIFで取り扱える • Dashboard的なUIで、EDAからモデル評価、モデル解釈まで色々できる ( モデル評価周りの機能はpycaretの方が充実してたので、このためだ けには使わないかも。。。)

    • OSS版はメンテ具合が微妙 • そもそもsampleのnotebookがそのままだと動かない • Notebookの修正が必要なのが1件、そもそも本体のコードにBugが1件 • 他のOSSのWrapperに関しては、直接生で触ったほうが速いことも • Shapとかは色々な可視化パターンがあるが、interpretML経由では一番シンプルな ものしか対応してない • でもEBMは良いので、そのためだけに使う価値はありそう
  7. 精度(複雑性)⇔ 解釈性のTrade off The Science Behind InterpretML: Explainable Boosting Machine

    https://www.youtube.com/watch?v=MREiHgHgl0k&ab_channel=MicrosoftDeveloper 精度を犠牲にせずに解釈性 を高めた夢のモデル
  8. EBMの実装ではFASTという交差項選択のアルゴリ ズムを利用 • 最初に交差項を含まないモデルを作成 • そのモデルの残差を一番減らせる特徴量 のペアをモデルに加える • 新モデルの残差を一番減らせるペアを加 える

    • 精度が向上しなくなるまで繰り返す • 計算が膨大になるため、実装にはFu (xu ) の計算を軽くするための工夫がいくつか Accurate Intelligible Models with Pairwise Interactions Yin Lou, et al https://www.cs.cornell.edu/~yinlou/papers/lou-kdd13.pdf
  9. 個々のfi, fij のFittingには、浅い回帰木をベースとし たGradient Boostingを利用 The Science Behind InterpretML: Explainable

    Boosting Machine https://www.youtube.com/watch?v=MREiHgHgl0k&ab_channel=MicrosoftDeveloper • 交差項には決定木ライクな、 よりシンプルな手法を利用 • 特徴量の順番が影響しないよう、学 習率はかなり抑えめにする (Round-robin like)
  10. 実験の概要 • 利用したデータセット • 実PJにおける広告キャンペーン への反応予測(分類) • データ数 • 1,000~1,000,000の7パターン

    • 特徴量数 • 43 、48、73の3パターン • 比較用モデル • LGBM • ハイパラはデフォルト • 評価項目 • モデルの判別力 • ROC_AUC • モデルの合致性 • Logloss • Brier Score • 学習速度(sec) • 推論速度(sec)
  11. 小サンプルデータ(<100,000)においては LGBMを上回る精度(識別力も確率予測精度も) 0.740 0.795 0.802 0.810 0.811 0.814 0.814 0.706

    0.764 0.776 0.797 0.804 0.813 0.816 0.640 0.660 0.680 0.700 0.720 0.740 0.760 0.780 0.800 0.820 0.840 1000 5000 10000 50000 100000 500000 1084055 Sample num ROC_AUC EBM vs LGBM feature_num=43 EBM LGBM 0.046 0.045 0.044 0.044 0.044 0.043 0.043 0.050 0.047 0.046 0.044 0.044 0.043 0.043 0.038 0.040 0.042 0.044 0.046 0.048 0.050 0.052 1000 5000 10000 50000 100000 500000 1084055 Sample num Brier Score EBM vs LGBM feature_num=43 EBM LGBM EBM>LGBM
  12. 学習時間は50万行レベルになってくると無視でき ない差に 1.4 2.5 4.2 13.4 31.2 190.9 599.6 1.8

    3.8 5.3 32.1 72.3 469.9 1468.7 5.0 8.5 13.9 47.9 189.5 858.3 1304.6 0.9 0.5 0.3 0.5 1.0 4.2 11.6 0.3 0.8 0.5 1.1 2.3 7.2 30.5 1.6 7.1 2.2 3.5 7.4 8.0 15.6 0.0 200.0 400.0 600.0 800.0 1000.0 1200.0 1400.0 1600.0 1000 5000 10000 50000 100000 500000 1084055 1000 5000 10000 50000 100000 500000 1084055 1000 5000 10000 50000 100000 500000 1084055 43 48 73 Sample num/ Feature num train time(sec) EBM LGBM Localで回していたので、Zoom会議とかぶっていたfeature=48の108万行がfeature=73より遅くなっている。。。
  13. もっと知りたくなった人へ 今日の発表のもとにしたリンク集です • 論文 • Accurate Intelligible Models with Pairwise

    Interactions https://www.cs.cornell.edu/~yinlou/papers/lou-kdd13.pdf • InterpretML: A Unified Framework for Machine Learning Interpretability https://arxiv.org/pdf/1909.09223.pdf • Interpretable Machine Learning – A Brief History, State-of-the-Art and Challenges https://arxiv.org/pdf/2010.09337.pdf • 教科書的な • Interpretable Machine Learning A Guide for Making Black Box Models Explainable https://christophm.github.io/interpretable-ml-book/index.html • 動画 • The Science Behind InterpretML: Explainable Boosting Machine https://www.youtube.com/watch?v=MREiHgHgl0k&ab_channel=MicrosoftDeveloper • How to Explain Models with IntepretML Deep Dive https://www.youtube.com/watch?v=WwBeKMQ0-I8&t=964s&ab_channel=MicrosoftDeveloper • その他 • DiCE: 反実仮想サンプルによる機械学習モデルの解釈/説明手法 https://qiita.com/OpenJNY/items/ef885c357b4e0a1551c0 • 一般化線形モデル (GLM) & 一般化加法モデル(GAM) https://www.slideshare.net/DeepLearningLab/glm-gam