Anchors

LIME assumes a simple model can approximate the local boundary. To avod ths assumption, we can use Anchors.

An anchor finds an IF-THEN rule such as “debt ratio below 0.31 and income above $64,000” that keeps the prediction stable while the remaining features vary.

Precision and coverage

An anchor AA must satisfy a precision threshold τ\tau:

P(f(z)=f(x)A(z)=1)τP(f(z)=f(x)\mid A(z)=1)\geq\tau

Precision asks how often the rule preserves the prediction. Coverage asks how often the rule applies. Strong anchors balance both.

What Precision and Coverage Count

Each dot is a perturbed neighbor of one loan applicant. Switch rules to see which neighbors the rule captures — and of those, how many keep the same prediction.

rule applies, prediction stable rule applies, prediction flips rule doesn't apply

Coverage

43 of 50 neighbors
= 86%

How often does the rule apply?

Precision

32 of 43 covered
= 74%

Of those covered, how often is the prediction stable?

Precision failures

11 covered neighbors where the prediction changes

Coverage = rule applies / all neighbors. Precision = same prediction / rule applies. A rule can score 100% precision by covering just one neighbor.

Unbalanced data

The perturbation space reflects the training distribution. If your data is unbalanced, sampled perturbations will oversample the majority class, biasing precision and coverage estimates toward it. An anchor that looks reliable may simply be anchoring to the dominant group.

Anchors are constructed through a process called Modified Beam Search. Step through the interactive below to see how it works.

How Beam Search Builds an Anchor

Step through the four stages of anchor construction for a single loan applicant (debt ratio 0.27, income $72k, prediction: approved).

Stage 1 — Candidate Generation

One candidate rule is created per feature, fixing that feature's value for the instance being explained (debt ratio 0.27, income $72k). Each rule constrains which perturbations count as valid.

IF debt < 0.35

IF income > $65k

Round 1: two single-predicate seeds, one per feature.

Instance being explained

debt ratio: 0.27

income: $72k

prediction: approved

Precision threshold τ

0.90

Search progress

1Seed candidates
2Round 1 precision
3Round 2 extension
4Round 2 precision
5Anchor found
Modified Beam Search grows rules one predicate at a time. The Multi-Armed Bandit concentrates sampling on the most promising candidates, making precision estimation efficient.

Rules are easy to communicate, which makes anchors appealing in operational settings. The tradeoff is that a highly precise rule may explain only a tiny pocket of applicants. A broad rule may include cases where the prediction changes.

Report the rule, precision, coverage, perturbation process, and the population on which those numbers were measured.

Checkpoint

Why is a 99% precise anchor with 1% coverage a weak general explanation?