A SHAP value is a number that tells you how much each input feature contributed to a specific prediction made by a machine learning model. SHAP stands for SHapley Additive exPlanations, and it borrows a concept from game theory to solve one of the biggest problems in modern AI: figuring out why a model made the decision it did.
If a model predicts that a loan applicant will default, SHAP values can show you exactly which factors pushed the prediction in that direction (high debt, short credit history) and which factors pulled against it (stable employment, low spending). Every feature gets a score, and those scores add up to the final prediction.
The Game Theory Connection
In 1953, mathematician Lloyd Shapley proposed a method for fairly dividing a payout among players in a cooperative game, even when those players contributed unequally. Imagine three friends start a business together. One brings capital, one brings expertise, and one brings clients. When profits arrive, how do you split them fairly? Shapley’s answer was to consider every possible combination of players, measure what each person adds to each combination, and average those contributions.
SHAP applies this same logic to machine learning. Instead of players in a game, you have features (like age, income, or location) feeding into a model. Instead of a payout, you have the model’s prediction. The method works through every possible combination of features, checks how adding or removing a specific feature changes the prediction, and averages those changes. The result is each feature’s SHAP value: its fair share of responsibility for pushing the prediction above or below the baseline (the model’s average prediction across all data).
What SHAP Values Actually Tell You
A positive SHAP value means that feature pushed the prediction higher for a given input. A negative SHAP value means it pushed the prediction lower. A SHAP value near zero means the feature barely mattered for that particular case. The key insight is that SHAP values are specific to each individual prediction, not just averages across the whole dataset.
Say a model predicts house prices, and for one particular house the prediction is $350,000. The average prediction across all houses is $280,000, so $70,000 needs to be explained. SHAP might tell you the neighborhood added $40,000, the square footage added $25,000, the old roof subtracted $10,000, and the number of bathrooms added $15,000. Those contributions sum to exactly $70,000. This is one of SHAP’s core guarantees: the values for all features always add up to the difference between the prediction and the baseline.
Local Explanations and Global Patterns
Each SHAP value explains a single prediction for a single data point. These are called local explanations, and they’re useful when you need to know why the model made a specific call, like why one patient was flagged as high-risk or why one transaction was marked as fraud.
But you can also combine many local explanations to understand the model’s behavior overall. By plotting SHAP values for every data point in a dataset, you can see which features matter most across the board, how often they matter, and in which direction. These summary views avoid a common problem with simpler importance measures, which tend to collapse everything into a single number. SHAP summary plots can reveal, for example, that a feature rarely matters but has a huge effect when it does. Research from the team that developed TreeSHAP showed that combining local SHAP explanations into global views is more accurate at detecting true feature dependencies than traditional global importance methods.
Different Versions for Different Models
Computing exact SHAP values requires checking every possible combination of features, which gets astronomically expensive as the number of features grows. Several faster variants exist, each tailored to different types of models.
- KernelSHAP is model-agnostic, meaning it works with any machine learning model. It approximates SHAP values by sampling combinations of features rather than exhaustively testing all of them. This makes it flexible but slower.
- TreeSHAP is designed specifically for tree-based models like random forests and gradient-boosted trees. It exploits the structure of decision trees to calculate exact SHAP values (assuming features are independent) much faster than KernelSHAP can approximate them. It also tends to more sharply distinguish the most important features from the rest.
- DeepSHAP is built for deep neural networks, using the layered architecture of these models to speed up calculations.
These variants don’t always agree with each other. Research comparing KernelSHAP and DeepSHAP on the same models found significant disagreements in the magnitude of their values. KernelSHAP and TreeSHAP showed closer agreement when applied to the same tree-based model, which makes sense since they’re calculating the same thing, just differently. The practical takeaway: the variant you choose can affect your results, so it’s worth using the one designed for your model type when possible.
Where SHAP Values Are Used
SHAP values have become especially important in fields where people need to justify or understand AI decisions. In healthcare, clinical decision support systems use SHAP to show doctors why an AI recommends a particular treatment or flags a patient as high-risk. Research published in NPJ Digital Medicine found that most AI-powered clinical decision support systems provide clinicians with SHAP plots to visualize how predictions are derived. In one study, a system selected the top three SHAP values from its predictions and translated them into plain-language clinical explanations, which improved clinicians’ trust, satisfaction, and willingness to use the tool.
In finance, SHAP values help explain credit scoring and fraud detection models. Regulatory environments increasingly expect that automated decisions affecting people’s lives can be explained, and SHAP provides a mathematically grounded way to do that.
The Correlated Features Problem
SHAP values have a strong theoretical foundation, but they aren’t perfect. The most significant limitation involves correlated features. When two or more features are closely related (like height and weight, or income and education level), SHAP can distribute credit between them in misleading ways.
Consider a model where only one feature truly matters, but a second feature happens to be perfectly correlated with it. SHAP will split the importance between both features, making the irrelevant one look meaningful. The reverse can also happen: a feature that genuinely drives predictions can appear unimportant because its credit gets spread across several correlated features. In extreme cases with many perfectly correlated features, SHAP values for the truly important feature shrink toward zero as the number of correlated copies increases.
Some researchers have claimed that SHAP handles correlation better than alternative methods. The reality is more nuanced. SHAP distributes signal among correlated features rather than zeroing them out entirely, which some see as fairer. But this redistribution can inflate the apparent importance of features that have no real relationship with the outcome. As one analysis put it, SHAP values “can be quite misleading in the presence of correlation,” and this remains an active challenge rather than a solved problem.
Reading SHAP Visualizations
Most SHAP libraries generate a few standard plot types. A force plot shows one prediction: features pushing the value higher appear on one side, features pushing it lower appear on the other, and the widths correspond to the magnitude of each feature’s SHAP value. You can read it left to right as a tug-of-war between factors that increase and decrease the prediction.
A beeswarm plot (sometimes called a summary plot) shows SHAP values for every data point in the dataset, with one row per feature. Each dot represents a single prediction. The horizontal position shows whether the feature pushed the prediction up (right) or down (left), and the color indicates whether the feature’s actual value was high or low. This lets you spot patterns quickly: if high values of a feature consistently push predictions up, you’ll see a cluster of warm-colored dots on the right side of that row. Features are typically sorted from top to bottom by overall importance, so the most influential features appear at the top.
A bar plot is the simplest view, showing the average absolute SHAP value for each feature across the dataset. It answers the question “which features matter most overall?” but doesn’t tell you the direction of the effect.

