TRACK A · 11.1.1

Rule-based explanations

Rule-based explanations

Learning outcomes

1. IF–THEN rules

IF conditions THEN class: a conjunction defines applicability, not a causal mechanism.

Consider a classifier rule: IF income exceeds a threshold AND debt burden is below a threshold THEN class 1. Each predicate is true or false; all must hold. A rule describes decisions on a subset, not correctness or fairness.

2. Intrinsic and surrogate rules

An intrinsic tree path describes that tree exactly; a surrogate rule approximates another model and needs independent evaluation.

An intrinsic tree path is the conjunction of comparisons from root to leaf, with the leaf prediction as its conclusion. A surrogate instead learns from the original model's predictions rather than true labels; it can inherit original errors.

3. Local and global rules

Global rule systems cover many examples, local rules a selected region. Specify ordering, conflict resolution and a default for overlapping rules.

Rules may be mutually exclusive like tree leaves or overlap. Conflicting predictions require an explicit policy: an ordered list uses the first match, while unordered sets need conflict resolution. Uncovered inputs need a default or abstention.

4. Quality metrics

Fidelity is agreement with model predictions, accuracy agreement with true labels, coverage the fraction satisfying a rule; conditional fidelity measures agreement among covered cases.

Let N be test size, C covered cases and M model-surrogate agreements over the test. Fidelity=M/N and coverage=C/N. For 30 of 300 covered cases and 17 agreements, local fidelity=17/30≈56.7%. Accuracy uses true targets, not model predictions.

5. Rule extraction

Example: x0 ≤ −0.04 predicts 0, otherwise 1. Rounded thresholds are illustrative; use exact tree parameters in code.

Try x0=−0.1 and x0=0.2: the former enters the left branch, the latter the right. Evaluate every predicate in a longer rule. Rounded thresholds can change boundary cases; retain exact thresholds for implementation.

6. Random Forest experiment

Train Random Forest, fit a surrogate on separate model-labelled extraction data and evaluate on 300 held-out examples. Depth 1,3,5 yields 2,6,8 leaves with identical fidelity 0.8933 and accuracy 0.8367. Black-box accuracy 0.9100.

Use 600 samples to train the black box, 300 for extraction and 300 for independent evaluation. On the last set, 268 agreements yield 89.33% fidelity and 251 correct predictions yield 83.67% accuracy. Equal aggregate metrics across depths do not prove identical decisions, but do not justify more complex trees by these metrics alone.

DepthLeavesFidelityAccuracy
1289.33%83.67%
3689.33%83.67%
5889.33%83.67%

7. Local reliability

A leaf covering 10% of cases has fidelity 0.5667. Global averages conceal weak regions. Zero coverage gives no estimate.

In the weak leaf, 13 of 30 decisions disagree with the black box. Global 89.33% fidelity cannot be promised there. Report support, coverage and fidelity per leaf; rare groups yield unstable estimates.

8. Audit

Audit threshold stability, rare groups, drift and test leakage. Complexity alone does not improve explanations.

Check how thresholds vary under retraining and new data, and inspect examples in weak or conflicting regions. Choose depth on a separate validation set, not the final test. Agreement with a model is not causal evidence.

9. Laboratory

Run the lab, vary depth, leaf size and seed; compare fidelity, coverage and rule count. Prefer simpler rules only after checking local failures. Anchors follow in the next lesson.

Run the script with pinned dependencies and reproduce the baseline table. Change one parameter at a time while preserving the split. Tabulate errors by leaf and choose a complexity-reliability tradeoff. State precisely which regions are unsuitable for the rule.

Practice

Run the lab, vary depth, leaf size and seed; compare fidelity, coverage and rule count. Prefer simpler rules only after checking local failures. Anchors follow in the next lesson.

python -m pip install numpy==2.3.5 scikit-learn==1.8.0
python a-11-1-1-rule-surrogate.py

Python

depth=1 leaves=2 fidelity=0.8933 accuracy=0.8367
depth=3 leaves=6 fidelity=0.8933 accuracy=0.8367
depth=5 leaves=8 fidelity=0.8933 accuracy=0.8367
black_box_accuracy=0.9100

Sources

Glossary

Fidelity / Accuracy / Coverage
Fidelity is agreement with model predictions, accuracy agreement with true labels, coverage the fraction satisfying a rule; conditional fidelity measures agreement among covered cases.

Self-check

Why does 89.33% not guarantee each rule is reliable?

A leaf covering 10% of cases has fidelity 0.5667. Global averages conceal weak regions. Zero coverage gives no estimate.