> ## Content Index
> Fetch the complete content index at: https://bongholee.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Anchors - High Precision Model-Agnostic Explanations
- URL: https://bongholee.com/anchors-high-precision-model-agnostic-explanations-2/
- Published: 2022-04-23T01:16:00.000Z
- Updated: 2022-04-23T01:16:00.000Z
- Author: Bongho Lee
- Tags: XAI, Data, #Import 2026-11-22 06:32

- Anchor는 쉽게 생각하면 Blackbox 모델의 특정 Instance에 대한 설명을 If-Then 형태의 Rule 형태로 설명한다고 보면 된다.
- Anchors는 기존 Blackbox Model을 최대한 적게 호출하기 위해서, graph search algorithm와 Reinforcement learning techniques (MAB)를 적절히 활용한다.
- Rule이라는 것이 하단의 그림처럼 Feature에 기반해서 범위 형태로 설명하기 때문에 현재 가지고 있지 않은 데이터에 대해서도 설명을 제공할 수 있다는 장점을 가지고 있다. 그래서 재사용이 가능하다.
- LIME처럼 설명하고자 하는 Instance \\( x \\)의 Neighborhood를 Perturbation을 통해서 생성하고 이를 기반으로 Rule(Anchor) 를 구축해나간다.
- Anchor \\(A\\)는 다음과 같이 정의된다 → \\( E\_{D\_x(z|A) }\[1\_{\\hat{f}(x) = \\hat{f}(z) }\] \\ge \\tau, A(x) = 1\\)
- Anchor의 경우 설명하고자 하는 인스턴스 \\(x\\)가 있고 \\(A(x)=1\\)은 Rule A가 있을 때 x의 Feature와 Rule A의 Feature값이 모두 부합될 때 이다. 이 때 \\(D\_x(\\cdot|A)\\)은 Rule A에 Matching되는 \\(x\\)의 Neighborhood의 Distribution인데 이 Distirbution의 기댓값이 특정 \\(\\tau\\)라는 threshold를 넘어야 \\(A(x)=1\\)로 간주한다.

![](https://bongholee.com/content/images/2022/02/image-9.png)

Source: https://christophm.github.io/interpretable-ml-book/anchors.html

## **Finding Anchors**

- Probabilistic Defintion as follows:
- \\( P(prec(A) \\ge \\tau ) \\ge 1- \\delta \\hspace{0.3cm} with \\hspace{0.3cm} prec(A) = E\_{D\_x(z|A)}\[1\_{\\hat{f(x)}=\\hat{f(z)}}\] \\)
- Coverage: \\( cov(A) = E\_{D\_{(z)}}\[A(z)\] \\)
- Coverage를 Maximization할 수 있는 Anchor를 찾아야 한다.  
\\( \\underset{A:\\textrm{s.t.};P(prec(A)\\geq\\tau)\\geq{}1-\\delta}{\\textrm{max}}cov(A) \\)

### **Approach**

- Candidate Generation: \\(x\\)의 Feature별로 Candidate을 만듬, 10개의 Feature면 10개의 Candidate(Rule)이 우선 마들어짐. 매번 Round마다 Best Candidate에 이전에 포함되어 있지 않던 Feature를 추가시키면서, Candidate를 만듦.
- Best Candidate Identification: \\(x\\)를 가장 잘 설명하는 Candidate을 찾기 위해 Candidate 간에 비교가 이뤄짐 . 이 작업을 위해서 모델을 계속 Call해야 함. 이 때 실행횟수를 최소화하기 위해서 MAB(Multi Armed Bandit) 사용
- Candidate Precision Validation: 정해놓은 \\(\\tau \\)를 초과할 때까지 계속적으로 이 작업을 반복한다.
- Beam Search와 MAB를 적절히 이용해서 기존 Blackbox Model 호출을 최소화하면서 Best Anchor들을 찾는다.
- Beam Search는 $FeatureCount(x)$ 만큼 진행이 됨.

![](https://bongholee.com/content/images/2022/02/image-8.png)

SourceS: https://christophm.github.io/interpretable-ml-book/anchors.html

## **Advantages & Disadvantages**

### **Advantages**

- easy to interpret
- Anchor는 부분집합을 별도로 표기할 수도 있음 → A1) A>X, B>Y, A2) A>X, 이런 식으로 각각 설명할 수 있고 이에 따른 Coverage나 Importance도 설명할수 있음
- 그리고 강화학습을 쓰기 때문에 Surrogate Model 대비 Underfitting Issue도 없고, 설명하고자 하는 데이터와 neighborhood역시 비선형이어도 이슈없이 작동함
- model-agnostic

### **Disadvantages**

- 대부분의 Perturbation 모델이 그렇듯이 설정해야할 Parameter가 매우 많다. (Beam Serach에서 Hyperparameter 등)
- 때로는 결과가 너무 디테일할 수 있어서, Discretization이 필요할 수 있음
- ML Model에 대한 많은 호출이 요구된다. MAB를 쓴다고 해도, 모델의 성능에 대한 의존도가 높음
- Coverage의 정의가 여전히 특정 도메인(이미지) 등에서는 명확하지 않다.

## **References**

- [Interpretable Machine Learning](https://christophm.github.io/interpretable-ml-book/anchors.html?ref=bongholee.com)