Partial dependence: the average response
For a feature x, a partial-dependence plot sets x to a sequence of values for every row, keeps the other features as observed, predicts, and averages the results. It asks: how does this model’s average prediction change as x changes?
The average can hide different responses. In the visualiser, choose Interaction between x and the group as “On - effect reverses by group.” One group’s prediction rises with x while the other’s falls. Their average can look nearly flat even though neither group has a flat response.
ICE: show each row’s curve
An individual conditional expectation (ICE) curve applies the same feature sweep to one row at a time. The partial-dependence curve is the average of those predictions. Choose Show individual curves to see the variation hidden by the average; with the interaction turned on, the curves reveal why the overall line can mislead.
ICE and partial dependence describe how the fitted model responds to altered inputs. They are not causal effects. If features are strongly correlated, changing one feature while leaving all others fixed may create combinations that are rare or impossible in the real data. The model’s predictions there may not be reliable. For correlated inputs, use domain knowledge and consider methods designed to stay within the observed feature distribution, such as accumulated local effects.
SHAP: contributions for one prediction
SHAP gives each feature a contribution to a particular prediction relative to a baseline prediction. In an additive explanation, the baseline plus the feature contributions sums to the explained model output (on the method’s chosen output scale). A positive contribution moves that prediction above the baseline; a negative contribution moves it below.
SHAP values are based on Shapley-value ideas from cooperative game theory. Different explainers use different algorithms and assumptions; TreeSHAP is designed for tree models. The result depends on how missing features and feature dependence are handled, so always state the model, output scale and background data used. A contribution describes the model’s attribution under those choices—it does not show that changing the feature would cause the outcome to change.
| Need | Useful view |
|---|
| Average model response as one feature changes | Partial dependence |
| Variation between individual responses | ICE |
| Feature contributions to one prediction | SHAP |
For broader model reliance, compare with permutation importance. For implementation details, see scikit-learn’s partial dependence guide and the SHAP documentation.