Integrated gradients explains one prediction at a time. What if you want the bigger picture — how does the model's answer change, on average, as one feature sweeps across its whole range? Averaging sounds safe. It isn't always.
Sweep across a grid, holding at one row's actual value. Different rows trace completely different lines — some rising, some falling — while the average across all of them stays perfectly flat.
A partial dependence plot (PDP) sweeps one feature across a grid, holding every other feature at each training row's own observed value, and averages the resulting prediction across all rows:
- — the estimated partial dependence at : the model's average prediction when this feature is fixed there.
- — the feature being swept across a grid of values.
- — every other feature, held at row 's own observed value instead of being swept.
- — the number of training rows being averaged over.
- — the trained model's prediction function.
- ICE curves: the same sweep, per row
An ICE (individual conditional expectation) curve is the same sweep, but for one row at a time, with no averaging.
- PDP is the mean of the ICE curves
PDP is the average of all the ICE curves — which means whatever the ICE curves disagree about, the PDP quietly erases.
Four rows, four different slopes — some rising steeply, some falling steeply, driven entirely by each row's own . The dashed average line never leaves zero, the entire time.
— a pure interaction, no effect of on its own. Four rows: :
- Every row has a real, strong effect from x1
At , each row's prediction is :
- :
- :
- :
- :
A spread of — clearly matters, a lot, for every single row.
- The average cancels it exactly
. This holds at every grid value of from to : the PDP is — flat, because the symmetric values always cancel regardless of .
- A flat PDP doesn't mean a feature doesn't matter
The PDP alone would say " has no effect." The ICE curves say the opposite: 's effect is real and large, it just flips sign depending on — an interaction the averaged view is structurally incapable of showing.
Find the value of x1, among the five grid points, where the rows disagree the most — even though the PDP is flat everywhere.
A PDP is only trustworthy when the ICE curves it's averaging roughly agree with each other. When they don't — because of an interaction, like here, or any other source of heterogeneity — the PDP isn't wrong, exactly, but it's answering a question ("what's the effect on average?") that isn't the one usually being asked ("does this feature matter?"). The next chapter turns to a model family where feature importance comes from the training procedure itself, not from probing an already-trained model after the fact.