SHAP — short for SHapley Additive exPlanations — answers "how much did each feature contribute?" A rejected applicant usually wants a more actionable answer: "what's the smallest change to my application that would have gotten me approved?"
This is Part I Chapter 6's gradient field again, but the "loss" is now a linear approval score, and the gradient — constant everywhere, since the score is linear — always points in the one direction that increases it fastest. Drag the point: that arrow is the cheapest possible direction to move toward "approved."
For a linear decision function , approved when , the closest point on the boundary itself — the smallest possible change that flips the decision — has a closed form:
- — the current point, e.g. an applicant's feature values.
- — the linear decision function's score at ; approved when .
- — the decision function's weight vector.
- — the counterfactual point: the nearest point on the decision boundary.
- — how far sits from the boundary.
- The same gradient direction, scaled to land exactly on the boundary
This is exactly Chapter 6's gradient direction, scaled to land precisely on instead of just pointing that way — the same idea Part I used to walk downhill, now used to walk to the nearest point where a linear classifier's answer changes.
Drag the point anywhere. The marked counterfactual point always sits on the boundary, always at the foot of the perpendicular from wherever you are — never straight toward the origin, never toward any other fixed spot. The cheapest fix depends entirely on where the applicant currently stands.
With weights (so ) and bias , starting from :
- Check the current decision
— denied, and units from the boundary.
- Find the nearest counterfactual
.
- Verify it's exactly on the boundary
— exactly zero, confirming is the smallest possible change from that flips the decision.
Drag the point until the decision flips from denied to approved.
For a linear model this is exact and cheap — the same closed form the SHAP chapter used. For a real, nonlinear classifier, there's no single formula: finding the nearest point that flips the decision becomes its own small optimization problem, usually solved by taking gradient steps toward the boundary rather than jumping there in one shot. But the question stays exactly the same, and it's often the most useful answer of all: not why the model decided what it did, but what would have to change.