6.3.11 · D3Interpretability & Explainability

Worked examples — Concept-based explanations

2,139 words10 min readBack to topic

This page drills TCAV until no case surprises you. Before we compute, one promise: every symbol used here is defined the moment it appears. If you have not yet met the dot product or the gradient, read the two boxes below — they are the whole toolkit.


The scenario matrix

Every TCAV situation you will ever meet falls into one of these cells. The worked examples below are tagged with the cell(s) they cover.

# Case class What is unusual Example
A Sign positive — concept agrees with class on most inputs Ex 1
B Sign negative — concept opposes class Ex 2
C Zero / perpendicular — concept irrelevant dot product Ex 3
D Degenerate CAV — the direction is meaningless near zero / unnormalized Ex 4
E Random-baseline boundary — signal vs noise TCAV just above 0.5 Ex 5
F Statistical-significance / p-value many random trials Ex 6
G Real-world word problem — spurious concept grass vs stripes Ex 7
H Limiting values — TCAV = 0 and = 1 exactly all-agree / all-oppose Ex 8
I Exam twist — sign flips under CAV negation Ex 9

We will do them in order. Cells A, B, C, H, I are pure geometry — they get figures.


Example 1 — Cell A: the concept points uphill

  1. Compute the dot product . Why this step? The sign of this single number is the whole test — positive means "uphill along the concept."
  2. Read the sign. , so the indicator : this image is counted. Why this step? TCAV over many images is just the average of these 0/1 votes.

Verify: Geometrically (figure), the gradient arrow makes an angle with whose cosine is . A positive cosine ⇔ positive dot product. Consistent. ✓


Example 2 — Cell B: the concept opposes the class

  1. Dot product: . Why this step? Only the component along survives; the is perpendicular to and contributes nothing.
  2. Sign: . This image is not counted; the concept pushes the score down here. Why this step? A concept can actively work against a class — TCAV near 0 is a real, informative outcome, not "no data."

Verify: . Negative cosine ⇒ obtuse angle ⇒ the arrows genuinely disagree. ✓


Example 3 — Cell C: perpendicular = concept irrelevant

  1. Dot product: . Why this step? This is the degenerate boundary between counted and not-counted.
  2. Apply the indicator. The condition is strict: . Since is not , this image is not counted. Why this step? The convention matters at the exact boundary — many students miscount here.
  3. Interpret at the class level. If every gradient were perpendicular to , TCAV , meaning "moving toward the concept doesn't change the score at all." The concept is orthogonal to what the model cares about.

Verify: . A right angle — no agreement, no disagreement. ✓


Example 4 — Cell D: a degenerate CAV

  1. Normalize the CAV. . Unit CAV: . Why this step? TCAV only reads the sign of the dot product; scaling scales the number but never flips its sign. A tiny magnitude is not "weak usage."
  2. Recompute with the unit CAV. . Why this step? Same sign as the raw — proving the panic was baseless.

Verify: raw dot product ; normalized . Both positive → same vote. ✓


Example 5 — Cell E: is 0.55 really above the noise floor?

  1. Compute the z-score (how many std-devs above the random mean): Why this step? The std-dev of the random baseline is the ruler for "how big is big." Comparing to 0.5 alone ignores the noise scale.
  2. Judge. is well under the usual () bar. So is not significant — likely noise. Why this step? This is exactly Mistake 2 from the parent note, made quantitative.

Verify: ; since , fail to reject the null. ✓


Example 6 — Cell F: the exact p-value

  1. Plug into the formula Why this step? The "" and "" (Laplace/add-one) stop from ever being exactly — you can never prove zero chance from finite trials.
  2. Compare. significant. The stripe concept is genuinely used. Why this step? This is the pass/fail gate that turns a raw number into a claim.

Verify: . Significant. ✓ Note: with only trials, would not be — the trial count matters.


Example 7 — Cell G: the real-world spurious concept

  1. Z-score each concept against the random baseline (ruler ):
    • stripes:
    • grass:
    • four-legs: Why this step? Raw scores mislead; z-scores tell us which are beyond noise.
  2. Interpret.
    • grass (): strongly, significantly used — a spurious concept.
    • stripes (): significantly anti-correlated — the model even mildly avoids stripes!
    • four-legs (): within noise, inconclusive. Why this step? Presence usage. Zebras have stripes, but this model classifies via background — exactly the parent note's warning.
  3. Danger. Deploy this on a zebra photographed on sand and it fails: the grass cue vanishes.

Verify: , , . Only grass and stripes exceed . ✓ Links to Adversarial Examples (spurious cues) and Model Editing (ablate the grass CAV).


Example 8 — Cell H: the two limiting values

  1. All positive. Every vote is , so . Geometry: every gradient arrow lies in the same half-plane as (angle ). Why this step? is the hard ceiling — "the concept helps this class every single time."
  2. All negative. Every vote is , so . Geometry: every gradient arrow is in the opposite half-plane (angle ). Why this step? is the floor — "the concept opposes this class every time." Not the same as "irrelevant" (Ex 3, where it hovers at ).

Verify: and ; both lie in . The midpoint is the random-half-plane split. ✓


Example 9 — Cell I: the exam twist (negate the CAV)

  1. Effect on one dot product. . Every positive becomes negative and vice-versa. Why this step? Negating one vector negates the dot product's sign — this is the crux.
  2. Effect on the count. Every image that voted now votes (strictly-positive flips to negative), so the new score is only if no dot products were exactly zero. Assuming none are (generic case), . Why this step? The complement works because zero-dot-products (which flip still 0, since is false both ways) are measure-zero.
  3. Are they wrong? No — they measured the anti-concept "not-striped." Direction is a convention; report it consistently.

Verify: . Negation maps score (ignoring exact zeros). ✓


Key Takeaways

  1. TCAV reads only the sign of — magnitude and CAV length never change a vote (Ex 4).
  2. The three sign cases — positive (helps, Ex 1), negative (opposes, Ex 2), zero (irrelevant, Ex 3) — are geometrically an acute, obtuse, and right angle.
  3. Limits: TCAV (always helps) and (always opposes); random (Ex 8).
  4. A score is only meaningful relative to the random baseline — always z-score it (Ex 5, 7) and compute the p-value (Ex 6).
  5. Presence usage: a zebra model may live on grass, not stripes (Ex 7).
  6. Negating the CAV maps — it measures the anti-concept (Ex 9).

See also Probing Classifiers (does the concept exist?) versus TCAV (is it used?), and Feature Attribution Methods / Layer-wise Relevance Propagation for the pixel-level view these concept scores sit above.