2. 목차
Explainable Artificial Intelligence
(1) “Why Should I Trust You?” Explaining the Predictions of Any Classifier 2016 (Link)
(2) Grad-CAM: Visual Explanations from Deep Networks via Gradient-based Localization 2016 (LINK)
(3) Attention Branch Network: Learning of Attention Mechanism for Visual Explanation 2019 (Link)
… will be added
4. 공통 (Why XAI?)
Basic Concept of this research
설명력
정확도
Logistic Simple Tree Complex Tree Deep Neural Net
딥러닝 모델은 뛰어난 성능을 보여주지만, 설명력이 부족하다는 단점이 있으며, 이러한 문제는 현장에 작용
하는데 문제가 된다. 이러한 문제를 해결하기 위한 다양한 연구들을 살펴보고자 한다.
5. LIME(Why Should I Trust You?” Explaining the Predictions of Any Classifier)
Basic Concept of this research
전체 주어진 데이터를 설명하는 Global 모델(복잡함)을 설명하는 대신에, 예식하고자 하는 예측 값 근처에 대
해서만 해석 가능한 Local 모델을(해당 값 주변의 데이터만 사용) 학습시키는 방법.
Global 모델은 너무 복잡하여, 해석하는 것이 매우 어렵지만, 예측 값 근처에 대해서만 해석 가능한 Local 모
델은 더 단순한(Linear) 형태로 구성하여 해석 가능하도록 만들 수 있을 것이다 라는 것이 핵심아이디어 .
부가적으로 어떤 모델이 오는지를 전혀 고려하지 않기 때문에 어떤 모델에도 적용할 수 있다는 장점도 존재.
예측 값
예측 값을
변형해서 만
든 데이터
6. LIME(Why Should I Trust You?” Explaining the Predictions of Any Classifier)
1. Interpretable Data Representations
Before we present the explanation system, it is important to distinguish between features and interpretable
data representations. As mentioned before, interpretable explanations need to use a representation that is
understandable to humans, regardless of the actual features used by the model. For example, a possible
interpretable representation for text classification is a binary vector indicating the presence or absence of a
word, even though the classifier may use more complex (and incomprehensible) features such as word
embeddings. Likewise for image classification, an interpretable representation may be a binary vector
indicating the “presence” or “absence” of a contiguous patch of similar pixels (a super-pixel), while the
classifier may represent the image as a tensor with three color channels per pixel. We denote x ∈ R d be
the original representation of an instance being explained, and we use x 0 ∈ {0, 1} d 0 to denote a binary
vector for its interpretable representation.
실제 모델이 어떤 복잡한 Feature 를 사용하는 것과 관계 없이, 설명을 위한 모델에서는 사람이 이해할 수 있
는 단위로 0,1 과 같은 Binary 형태로 표시가 되어야 함.
예를들어 TEXT 라면 단어 단위의 존재 여부, 이미지라면 연속된 어떤 조각의 존재 여부 등으로 사람이 이해
할 수 있도록 구성 되어야 함.
7. LIME(Why Should I Trust You?” Explaining the Predictions of Any Classifier)
Fidelity-Interpretability Trade-off
Formally, we define an explanation as a model g ∈ G, where G is a class of potentially interpretable
models, such as linear models, decision trees, or falling rule lists [27], i.e. a model g ∈ G can be readily
presented to the user with visual or textual artifacts. The domain of g is {0, 1} d 0 , i.e. g acts over
absence/presence of the interpretable components. As not every g ∈ G may be simple enough to be
interpretable - thus we let Ω(g) be a measure of complexity (as opposed to interpretability) of the
explanation g ∈ G. For example, for decision trees Ω(g) may be the depth of the tree, while for linear
models, Ω(g) may be the number of non-zero weights. Let the model being explained be denoted
. In classification, f(x) is the probability (or a binary indicator) that x belongs to a certain class1
. We further use πx(z) as a proximity measure between an instance z to x, so as to define locality around
x. Finally, let L(f, g, πx) be a measure of how unfaithful g is in approximating f in the locality defined by
πx. In order to ensure both interpretability and local fidelity, we must minimize L(f, g, πx) while having
Ω(g) be low enough to be interpretable by humans. The explanation produced by LIME is obtained by
the following:
위는 설명 모델이 추구하는 모델은 복잡하지 않으면서, 타겟 데이터(예측)과 주변 데이터(생성)간을 구분하
는 성능 또한 만족 시켜야 한다는 점을 설명하고 있으며, G(설명에 사용할 모델), L(Loss Function,
정해진 Local 구역에서 복잡한 예측 모델 f를 g 가 얼마나 잘 근사하는지 정도(잘 못하는 정도) Omega(g)
모델은 설명 가능할 정도 복잡도 3가지를 어떻게 하느냐에 따라 다양하게 구성 가능하다.
Eq1 :
8. LIME(Why Should I Trust You?” Explaining the Predictions of Any Classifier)
Sampling for Local Exploration
We want to minimize the locality-aware loss L(f, g, πx) without making any assumptions about f, since
we want the explainer to be model-agnostic. Thus, in order to learn the local behavior of f as the
interpretable inputs vary, we approximate L(f, g, πx) by drawing samples, weighted by πx. We sample
instances around x’ by drawing nonzero elements of x’ uniformly at random (where the number of such
draws is also uniformly sampled). Given a perturbed sample z’ ∈ {0, 1} d’ (which contains a fraction of
the nonzero elements of x’ ), we recover the sample in the original representation z ∈ R and obtain f(z),
which is used as a label for the explanation model. Given this dataset Z of perturbed samples with the
associated labels, we optimize Eq. (1) to get an explanation ξ(x). The primary intuition behind LIME is
presented in Figure 3, where we sample instances both in the vicinity of x (which have a high weight due
to πx) and far away from x (low weight from πx). Even though the original model may be too complex to
explain globally, LIME presents an explanation that is locally faithful (linear in this case), where the
locality is captured by πx. It is worth noting that our method is fairly robust to sampling noise since the
samples are weighted by πx in Eq. (1). We now present a concrete instance of this general framework.
Loss Function 은 실제모델, 설명모델, 로컬지역에서 타겟과 비교군의 차이 3가지로 이루어지는데, 우리는
여기서 f 를 제외하고 g 를 훈련하고 싶다(어떤 모델에도 적용할 수 있도록). 이를 위해서 Sampling 을 하는
형태로 추정을 한다. Smaple 예시 : {분류 클래스, 변형된 데이터, 원래 데이터와의 거리}
9. LIME(Why Should I Trust You?” Explaining the Predictions of Any Classifier)
Sparse Linear Explanations
For the rest of this paper, we let G be the class of linear models, such that g(z 0 ) = wg ·z’. We use the
locally weighted square loss as L, as defined in Eq. (2), where we let πx(z) = exp(−D(x, z) 2 /σ2 ) be an
exponential kernel defined on some distance function D (e.g. cosine distance for text, L2 distance for
images) with width σ.
설명 모델은 무엇이든 될 수 있지만, 여기서는
가장 간단한 선형 모델
TEXT 라면 cosine distance, 이미지라면 L2
텍스트라면 단어의 수, 이미지라면 segment 의
수가 되며, K는 사용자 조정치로 해당 수치 이상
은 무한대 loss 가 되도록 함
※ x 는 특정 Local 위치를 의미하며, 실제로는
원래 훈련셋의 데이터
성능 복잡도
원본 데이터와 생성
데이터간의 거리
(가까우면 1 멀면 0)
원래 모델의 분류 성
능을 얼마나 모방
할 수 있는지 정도
10. LIME(Why Should I Trust You?” Explaining the Predictions of Any Classifier)
Practical Explanation
(1) 원본 데이터를 Segment 로 나누고 여러 가지의 조합을 만든다.
(2) 여러가지 조합과 원본과의 거리(유사도)를 구한다.
(3) 새로운 데이터(조합한)를 대상으로 복잡한 모델(예:딥러닝)을 사용하여 예측을 한다
(4) 조합한 데이터 셋 중에서 가장 좋은 결과가 나온 N 개를 선택한다.
(5) 해당 조합의 유사도롤 Weight 로 하는 간단한 선형 모델을 만든다
(6) 간단한 모델을 사용하여, 해당 모델을 설명하도록 한다.
11. LIME(Why Should I Trust You?” Explaining the Predictions of Any Classifier)
Implementation Example
https://github.com/marcotcr/lime https://marcotcr.github.io/lime/tutorials/Li
me%20-%20multiclass.html