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

Accumulated Local Effects(ALE)で機械学習モデルを解釈する / T...

森下光之助
October 30, 2021

Accumulated Local Effects(ALE)で機械学習モデルを解釈する / TokyoR95

2021年10月30日に行われた、第95回R勉強会@東京(#TokyoR)での発表資料です。
https://tokyor.connpass.com/event/225967/

コードはこちらになります。
https://github.com/dropout009/tokyor95

森下光之助

October 30, 2021
Tweet

More Decks by 森下光之助

Other Decks in Science

Transcript

  1. Partial Dependence PD PD! 𝑥" = 𝔼 & 𝑓 𝑥"

    , 𝑿∖" = * & 𝑓 𝑥" , 𝒙∖" 𝑝 𝒙∖" 𝑑𝒙∖" ! 𝑓(𝑿) 𝑋!
  2. PD ' PD! 𝑥! = 1 𝑁 . "#$ %

    ! 𝑓(𝑥! , 𝒙",∖! )
  3. PD 𝑌 = 𝑋! + 𝑋" " + 𝜖 𝑋!

    , 𝑋" ∼ Uniform 0, 1 𝜖 ∼ 𝒩(0, 0.01") CDF
  4. PD ! 𝑓 𝑋$ , 𝑋( = 𝑋$ + 𝑋(

    ( PD! 𝑥! = 𝔼 9 𝑓 𝑥! , 𝑋" = 𝔼 𝑥! + 𝑋" " = ! # + 𝑥! PD" 𝑥" = 𝔼[ 9 𝑓 𝑋! , 𝑥" ] = 𝔼 𝑋! + 𝑥" " = ! " + 𝑥" " PD
  5. PD

  6. PD 𝑋! 𝑥! 𝑋" PD! 𝑥! = 𝔼 & 𝑓

    𝑥! , 𝑋" = ∫ & 𝑓 𝑥!, 𝑥" 𝑝 𝑥" 𝑑𝑥" PD 𝑋!
  7. 4 PD 𝑋! 𝑥! 𝑋" (𝑥!,# , 𝑥!,! ) (𝑥$,#

    , 𝑥$,! ) (𝑥%,# , 𝑥%,! ) 𝑥#,# , 𝑥#,!
  8. 𝑋! 𝑥! 𝑋" 𝑥#,# , 𝑥#,! (𝑥!,# , 𝑥!,! )

    (𝑥$,# , 𝑥$,! ) - PD! 𝑥! = ! ' & 𝑓 𝑥!, 𝑥!," + ! ' & 𝑓 𝑥!, 𝑥"," + ! ' & 𝑓 𝑥! , 𝑥(," + ! ' & 𝑓 𝑥! , 𝑥'," (𝑥%,# , 𝑥%,! ) ) 𝑓(𝑥# , 𝑥!,! ) ) 𝑓(𝑥# , 𝑥!,! ) ) 𝑓(𝑥# , 𝑥%,! ) ) 𝑓(𝑥# , 𝑥#,! ) PD
  9. PD 𝑋! 𝑥! 𝑋" PD! 𝑥! = 𝔼 & 𝑓

    𝑥! , 𝑋" = ∫ & 𝑓 𝑥!, 𝑥" 𝑝 𝑥" 𝑑𝑥" PD 𝑋!
  10. 築 𝑋! 𝑥! 𝑋" PD! 𝑥! = 𝔼 & 𝑓

    𝑥! , 𝑋" = ∫ & 𝑓 𝑥!, 𝑥" 𝑝 𝑥" 𝑑𝑥" CD! 𝑥! = 𝔼 & 𝑓 𝑥! , 𝑋" ∣ 𝑋! = 𝑥! = ∫ & 𝑓 𝑥!, 𝑥" 𝑝 𝑥" ∣ 𝑥! 𝑑𝑥"
  11. CD 𝑓 𝑋! , 𝑋" = 𝑋! + 𝑋" "

    𝑋! = 𝑋" CD! 𝑥! = 𝔼 & 𝑓 𝑥!, 𝑋" ∣ 𝑋! = 𝑥! = 𝔼 𝑥! + 𝑋" " ∣ 𝑋! = 𝑥! = 𝑥! + 𝔼 𝑋" " ∣ 𝑋! = 𝑥! = 𝑥! + 𝑥! " CD" 𝑥" = 𝔼 & 𝑓 𝑋!, 𝑥" ∣ 𝑋" = 𝑥" = 𝔼 𝑋! + 𝑥" " ∣ 𝑋" = 𝑥" = 𝔼 𝑋! ∣ 𝑋" = 𝑥" + 𝑥" " = 𝑥" + 𝑥" " CD 𝑋! 𝑋"
  12. ALE CD 𝑋! 𝑥! (") 𝑋" 𝑥! (() 𝑥! (')

    𝑥! (+) 𝑥! (,) 𝑥! (!) 𝑥#,# , 𝑥#,! 𝑥!,# , 𝑥!,! 𝑥$,# , 𝑥$,!
  13. ALE Local Effect Accumulate 𝑋! 𝑥! (") 𝑋" 𝑥! (()

    𝑥! (') 𝑥! (+) 𝑥! (,) 𝑥! (!) ) 𝑓 𝑥# ($), 𝑥#,! ) 𝑓 𝑥# ($) , 𝑥!,! ) 𝑓 𝑥# ($), 𝑥!,! ) 𝑓 𝑥# (%), 𝑥#,! ) 𝑓 𝑥# (%), 𝑥!,! ) 𝑓 𝑥# (%), 𝑥!,! Local Effect 1 3 ) 𝑓 𝑥# (%), 𝑥#,! − ) 𝑓 𝑥# ($), 𝑥#,! + 1 3 ) 𝑓 𝑥# (%), 𝑥!,! − ) 𝑓 𝑥# ($), 𝑥!,! + 1 3 ) 𝑓 𝑥# (%), 𝑥$,! − ) 𝑓 𝑥# ($), 𝑥$,! Local Effect
  14. ALE 𝑓 𝑋! , 𝑋" = 𝑋! + 𝑋" "

    𝑖 𝑋! [𝑥! (12!), 𝑥! (1)) Local Effect & 𝑓 𝑥! (1), 𝑥3," − & 𝑓 𝑥! 12! , 𝑥3," = 𝑥! 1 + 𝑥3," " − 𝑥! 12! + 𝑥3," " = 𝑥! 1 − 𝑥! 12! 𝑋" 𝑋! [𝑥! (12!), 𝑥! (1))
  15. ALE ALE Local Effect 𝑋4 𝜕 * 𝑓(𝑋", 𝑿∖") 𝜕𝑋"

    𝔼 𝜕 * 𝑓(𝑋", 𝑿∖") 𝜕𝑋" ∣ 𝑋" = 𝑧" ALE" 𝑥" = ; + ! (#$%) +! 𝔼 𝜕 * 𝑓(𝑋", 𝑿∖") 𝜕𝑋" ∣ 𝑋" = 𝑧" 𝑑𝑧" 𝑋4 = 𝑧4 Local Effect Local Effect 𝑥4 (567) ALE
  16. ALE ! 𝑓 𝑋$ + 𝑋( ( = 𝑋$ +

    𝑋( ( ALE ALE! 𝑥! = 9 8 9! 𝔼 𝜕(𝑋! + 𝑋" ") 𝜕𝑋! ∣ 𝑋! = 𝑧! 𝑑𝑧! = 9 8 9! 𝔼 1 ∣ 𝑋! = 𝑧! 𝑑𝑧! = 9 8 9! 1𝑑𝑧! = 𝑥! ALE" 𝑥" = 9 8 9" 𝔼 𝜕(𝑋! + 𝑋" ") 𝜕𝑋" ∣ 𝑋" = 𝑧" 𝑑𝑧" = 9 8 9" 𝔼 2𝑋" ∣ 𝑋" = 𝑧" 𝑑𝑧" = 9 8 9" 2𝑧"𝑑𝑧" = 𝑥 " "
  17. • Friedman, Jerome H. "Greedy function approximation: a gradient boosting

    machine." Annals of statistics (2001): 1189-1232. • Hooker, Giles, and Lucas Mentch. "Please Stop Permuting Features: An Explanation and Alternatives." arXiv preprint arXiv:1905.03151 (2019). • Apley, Daniel W., and Jingyu Zhu. "Visualizing the effects of predictor variables in black box supervised learning models." Journal of the Royal Statistical Society: Series B (Statistical Methodology) 82.4 (2020): 1059- 1086. • Molnar, Christoph. "Interpretable machine learning. A Guide for Making Black Box Models Explainable." (2019). https://christophm.github.io/interpretable-ml-book/. • Biecek, Przemyslaw and Tomasz Burzykowski. "Explanatory Model Analysis. Chapman and Hall/CRC (2021). https://pbiecek.github.io/ema/. • . . . (2021). https://is.gd/nkYPPG
  18. R