What are Shapley values?
Shapley values are a method for dividing a single model prediction among the input features that produced it, giving each feature a signed score for how far it pushed the result up or down. The idea comes from cooperative game theory, where Lloyd Shapley proposed it in 1953 as a fair way to split a payout among players who contributed different amounts. In machine learning the features are the players, and the payout is the gap between one prediction and the model’s average prediction. SHAP (SHapley Additive exPlanations) is the widely used open-source framework for computing them.
Shapley values are one of the main methods of explainable AI (XAI), alongside LIME and counterfactual explanations.
How Shapley values work
A feature’s Shapley value is its average marginal contribution: how much the prediction changes when that feature’s actual value is revealed, averaged over every order in which the features could be revealed. The values always add up, so the model’s average prediction plus the Shapley values of all features equals the prediction for that case. Exact calculation becomes impractical as features multiply, so SHAP uses shortcuts. TreeSHAP computes exact values quickly for tree-based models such as gradient-boosted decision trees, and KernelSHAP estimates them for any model by sampling. Averaging the absolute values across many predictions turns these local explanations into a global ranking of feature importance.
Shapley values in practice
A collections agency uses a gradient-boosted model to decide which accounts receive a reduced-balance settlement offer. Next to each recommendation, the representative’s screen shows the features that raised and lowered the score, such as a recent partial payment or a disconnected phone number. In the quarterly model review, the compliance team averaged SHAP values across all accounts and found the debtor’s ZIP code among the strongest drivers. Because ZIP code can stand in for race and income, the team removed it, retrained the model, and recorded the change in its model risk management file. In Kirk Tech Solutions engagements, the Shapley values behind each automated decision are stored in the audit log with the model version, so a reviewer can reconstruct the reasoning months later.
What to watch for
- Shapley values describe what the model relied on, which is not the same as what causes the outcome.
- Correlated features share credit unpredictably, so removing a proxy such as ZIP code can shift its weight to a related feature such as area code.
- Results depend on the background data that defines the average prediction, so record which dataset was used and keep it fixed between reviews.
- Sampling-based estimates vary from run to run, which matters when the values feed a reason given to a customer.