Notice
Recent Posts
Recent Comments
ยซ   2024/12   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Tags
more
Archives
Today
Total
๊ด€๋ฆฌ ๋ฉ”๋‰ด

Hello Potato World

[ํฌํ…Œ์ดํ†  ์Šคํ„ฐ๋””] Local Surrogate(LIME) ๋ณธ๋ฌธ

Study๐Ÿฅ”/XAI

[ํฌํ…Œ์ดํ†  ์Šคํ„ฐ๋””] Local Surrogate(LIME)

Heosuab 2021. 5. 24. 01:33

 

โ‹† ๏ฝก หš โ˜๏ธŽ หš ๏ฝก โ‹† ๏ฝก หš โ˜ฝ หš ๏ฝก โ‹† 

[XAI study_ Interpretable Machine Learning]

 

 

 


5.7 Local Surrogate (LIME)


 

Local Surrogate Model์ด๋ž€? Black box ๋ชจ๋ธ์˜ ๊ฐœ๋ณ„ ์˜ˆ์ธก์„ ์„ค๋ช…ํ•˜๋Š”๋ฐ ์‚ฌ์šฉํ•˜๋Š” ํ•ด์„ ๊ฐ€๋Šฅํ•œ ๋ชจ๋ธ

 

 

 

- Local Interpretable Model-agnostic Explanations(LIME):

  • ์ง€์—ญ ๋Œ€๋ฆฌ ๋ชจ๋ธ ์ œ์•ˆ
  •  Global Surrogate ๋ชจ๋ธ์ฒ˜๋Ÿผ ์ „์ฒด Dataset์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ทผ์‚ฌํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ,
    Black box ๋ชจ๋ธ์ด ์ฃผ์–ด์ ธ์„œ Data Point์„ ์›ํ•˜๋Š” ๋งŒํผ ์ž…๋ ฅํ•˜์—ฌ ๊ฐœ๋ณ„ ์˜ˆ์ธก์„ ์–ป์–ด๋‚ผ ์ˆ˜ ์žˆ์„ ๋•Œ, ๊ทธ Prediction๋“ค์„ ์ดํ•ดํ•˜๋Š” ๊ฒƒ

 

 

- for prediction

  • ๋ณ€ํ˜•๋œ sample๋“ค๊ณผ ์ด์— ๋Œ€ํ•œ Black box model์˜ ์˜ˆ์ธก๊ฐ’์œผ๋กœ ๊ตฌ์„ฑ๋œ ์ƒˆ Dataset
  • ์ด ์ƒˆ๋กœ์šด Dataset๋กœ ํ•ด์„ ๊ฐ€๋Šฅํ•œ ๋Œ€๋ฆฌ ๋ชจ๋ธ ํ•™์Šต
  • Sampled Instances์™€ Instance of Interest ์‚ฌ์ด์˜ ๊ทผ์ ‘์„ฑ์„ ํ†ตํ•œ weight ์ ์šฉ

 

 

- Local Surrogate Model:

Instance x์— ๋Œ€ํ•œ ์„ค๋ช… ๋ชจ๋ธ

  • ์›๋ž˜ ๋ชจ๋ธ f์™€์˜ Loss function L
  • L์„ ์ตœ์†Œํ™” ํ•˜๋Š” surrogate model g
  • ๊ทผ์ ‘๋„ ์ธก์ •๊ฐ’ pi(x) : instance x์˜ neighborhood ํฌ๊ธฐ ๊ฒฐ์ •
  • ๋ชจ๋ธ ๋ณต์žก๋„๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ์ง์ ‘ ๊ฒฐ์ •ํ•ด์•ผ ํ•จ

 

Steps to obtain a Surrogate Model :

 

1. Black box์˜ˆ์ธก์— ๋Œ€ํ•œ ์„ค๋ช…์„ ์›ํ•˜๋Š” Instance of Interest ์„ ํƒ

2. Dataset์„ ๋ณ€๊ฒฝํ•˜์—ฌ ์ƒˆ data points์— ๋Œ€ํ•œ ์˜ˆ์ธก๊ฐ’ ์–ป์Œ

3. Instance of Interest์™€์˜ ๊ทผ์ ‘๋„์— ๋”ฐ๋ฅธ ๊ฐ€์ค‘์น˜ ๊ณ„์‚ฐ

4. ๊ฐ€์ค‘์น˜๊ฐ€ ์ ์šฉ๋œ ํ•ด์„๊ฐ€๋Šฅํ•œ ๋Œ€๋ฆฌ ๋ชจ๋ธ์„ ๋ณ€ํ˜•๋œ Dataset์œผ๋กœ ํ•™์Šต

5. Local model ํ•ด์„, ์„ค๋ช…

Dataset์„ ๋ณ€ํ˜•ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ Tabular, Text, Image data ๊ฐ๊ฐ์— ๋Œ€ํ•ด ๋‹ค๋ฅด๋‹ค.

 

 

 


LIME for Tabular Data


 

Tabular Data์— ๋Œ€ํ•œ Random Forest Prediction

(A) ์ฃผ์–ด์ง„ Random Forest์˜ ์˜ˆ์ธก ํŠน์„ฑ : X1, X2 (predicted class : 1(์–ด๋‘์›€), 0(๋ฐ์Œ)

(B) Instance of Interest์™€ ์ •๊ทœ๋ถ„ํฌ์—์„œ sampling๋œ ์ƒˆ๋กœ์šด Dataset
(C) Instance of Interest์™€์˜ ๊ทผ์ ‘์„ฑ์„ ๊ณ ๋ คํ•œ weight ๋ถ€์—ฌ
(D) weighted samples์—์„œ local๋กœ ํ•™์Šต๋œ Decision Boundary (P(class=1)=0.5)

 

 

Specific Problem

  • ํŠน์ • ์  ์ฃผ๋ณ€์˜ neighbor ์ •์˜ํ•˜๊ธฐ๊ฐ€ ์–ด๋ ค์›€
  • ํ˜„์žฌ LIME์€ exponential smoothing kernel ์‚ฌ์šฉ
    • exponential smoothing kernel : ๋‘ ๊ฐœ์˜ instance๋ฅผ ๋ฐ›์•„์„œ ๊ทผ์ ‘์„ฑ ์ฒ™๋„(proximity measure)๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜
  • Kernel์˜ ๋„ˆ๋น„

 

=> ์ตœ์ƒ์˜ kernel์ด๋‚˜ ์ตœ์ ์˜ ๋„ˆ๋น„๋ฅผ ์ฐพ์„ ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์ด ์—†์Œ

instance๊ฐ€ x=1.6์ผ ๋•Œ์˜ ์˜ˆ์ธก๊ฐ’์— ๋Œ€ํ•œ ์„ค๋ช…

Kernel์˜ ํฌ๊ธฐ์— ๋”ฐ๋ผ ๋งค์šฐ ๋งค์šฐ ํŽธ์ฐจ๊ฐ€ ํฐ ๊ฒฐ๊ณผ๊ฐ’์„ ๋ณด์ž„

 

 

 


LIME for Text Data


Youtube๋Œ“๊ธ€์„ ์ŠคํŒธ(class=1) ๋˜๋Š” ์ผ๋ฐ˜(class=0)์œผ๋กœ ๋ถ„๋ฅ˜ํ•˜๋Š” Deep Decision Tree

Text Data์—์„œ์˜ ๋ฐ์ดํ„ฐ ๋ณ€ํ˜•๋ฐฉ์‹์„ ์‚ฌ์šฉํ•˜์—ฌ Dataset์˜ ์ผ๋ถ€ ๋ณ€ํ˜• ์ƒ์„ฑ

  • 1 : ๋‹จ์–ด์˜ ์ผ๋ถ€, 0 : ์ œ๊ฑฐ๋œ ๋‹จ์–ด
  • prob : ๊ฐ ๋ณ€ํ˜•๋œ ๋ฌธ์žฅ์— ๋Œ€ํ•œ ์ŠคํŒธ์˜ ์˜ˆ์ธก ๊ฐ€๋Šฅ์„ฑ
  • weight : (1-์ œ๊ฑฐ๋œ ๋‹จ์–ด์˜ ๋น„์œจ) : ์›๋ž˜ ๋ฌธ์žฅ์— ๋Œ€ํ•œ ๊ทผ์ ‘๋„
    (ex) 7๋‹จ์–ด ์ค‘ 2๊ฐœ์˜ ๋‹จ์–ด๊ฐ€ ์ œ๊ฑฐ๋˜์—ˆ๋‹ค๋ฉด weight=1-2/7

 

LIME ์•Œ๊ณ ๋ฆฌ์ฆ˜์œผ๋กœ ๋ฐœ๊ฒฌ๋œ local ๊ฐ€์ค‘์น˜

  • channel! feature๊ฐ€ Spam์œผ๋กœ ๋ถ„๋ฅ˜๋จ

 

 


LIME for Image Data


Image๋Š” Tabular, Text Data์™€๋Š” ๋‹ค๋ฅด๊ฒŒ ๊ฐœ๋ณ„ pixel์„ ๋ณ€ํ˜•ํ•˜๋Š” ๊ฒƒ์€ ์˜๋ฏธ๊ฐ€ ์—†์Œ

=> superpixel ๋‹จ์œ„๋กœ ๋ณ€ํ˜•
Superpixel : ๋น„์Šทํ•œ ์ƒ‰์ƒ์˜ ์ƒํ˜ธ ์—ฐ๊ฒฐ๋œ pixel

 

 

Inception V3 Neural Network๋กœ ์˜ˆ์ธกํ•œ Classification Top Prediction

  • "Bagel" : 77%
  • "Strawberry" : 4%

 

์œ„์˜ ์ด๋ฏธ์ง€๋Š” LIME ์•Œ๊ณ ๋ฆฌ์ฆ˜์œผ๋กœ ์„ค๋ช…๋œ "Bagel"๊ณผ "Strawberry" label์— ๋Œ€ํ•œ ์ •๋ณด ์‹œ๊ฐํ™”

  • Green : ๋ฒ ์ด๊ธ€๊ณผ ๋”ธ๊ธฐ์ผ ํ™•๋ฅ ์„ ์ฆ๊ฐ€์‹œํ‚ค๋Š” part
  • Red : ๋ฒ ์ด๊ธ€๊ณผ ๋”ธ๊ธฐ์ผ ํ™•๋ฅ ์„ ๊ฐ์†Œ์‹œํ‚ค๋Š” part

 

 


Advantages


  • ๊ธฐ์กด์˜ ๊ธฐ์ดˆ ๋ชจ๋ธ์„ ๋ณ€ํ˜•ํ•˜๋”๋ผ๋„ ๋™์ผํ•œ ๋กœ์ปฌ ๋ชจ๋ธ ์‚ฌ์šฉ ๊ฐ€๋Šฅ
  • ํ‘œ ํ˜•์‹์˜ ๋ฐ์ดํ„ฐ, ํ…์ŠคํŠธ, ์ด๋ฏธ์ง€์— ๋ชจ๋‘ ์ž‘๋™ํ•˜๋Š” ๋ช‡ ์•ˆ๋˜๋Š” ๋ฐฉ๋ฒ• ์ค‘ ํ•˜๋‚˜
  • ์›๋ž˜ ๋ชจ๋ธ์ด ํ•™์Šตํ•œ ๊ฒƒ๊ณผ ๋‹ค๋ฅธ ํŠน์„ฑ๋“ค์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Œ

 


Disadvantages


  • Neighbors์— ๋Œ€ํ•œ ์˜ฌ๋ฐ”๋ฅธ ์ •์˜ ๋ถˆ๋ถ„๋ช…
    ์—ฌ๋Ÿฌ kernel์„ ์‚ฌ์šฉํ•œ ์กฐ์ ˆ์„ ์‚ฌ์šฉํ•ด๋ณผ ์ˆ˜ ์žˆ์Œ
  • ์„ค๋ช… ๋ชจ๋ธ์˜ ๋ณต์žก์„ฑ์„ ๋ฏธ๋ฆฌ ์ง€์ •ํ•ด์•ผ ํ•จ
  • ์„ค๋ช…์˜ ๋ถˆ์•ˆ์ •์„ฑ : ์‹œ๋ฎฌ๋ ˆ์ด์…˜ ํ™˜๊ฒฝ๋งˆ๋‹ค ๋‹ค๋ฅธ ์„ค๋ช… ๋„์ถœ
    ์ƒ˜ํ”Œ๋ง ๊ณผ์ •์˜ ๋ฐ˜๋ณต์„ ํ†ตํ•ด ๊ฐœ์„  ๊ฐ€๋Šฅ

 

 

 

 


References


[1] Interpretable Machine Learning, Christoph Molnar

 

 

 

 

 

Comments