Explaining a Linear Prediction
Intuition
A linear model is a weighted sum, so its prediction splits naturally into one piece per feature. But "feature 2 contributed +30" only makes sense relative to something: compared with an average customer, a zero input, or last month's value.
Precise explanation
For and a baseline (reference) input (often the training mean):
The second property — contributions add up exactly to the difference from the baseline prediction — is called efficiency (or local accuracy). Using (baseline 0) is a special case and can be misleading when 0 is not a meaningful input (age 0, temperature 0 K). Interpretation also depends on feature scale: standardised features make comparable.
Worked example
w = [2, −1], b = 5, x = [3, 4], baseline = mean [1, 1]: φ = [4, −3]; f(x) = 7, f(x′) = 6, sum φ = 1 = 7 − 6 ✓.
Common mistakes
- Reporting alone as "importance" for one prediction (ignores the input value).
- Forgetting the baseline: contributions then do not add up to anything interpretable.
- Comparing weights of unscaled features.
Why this matters
This is the simplest exact attribution; Shapley values (XA-11) reduce to exactly this formula for linear models with independent features.
References
- Interpretable Machine Learning (3rd edition) — Christoph Molnar (
S024)