Sub topic 3
Reading Partial Dependence and ICE Plots
Assume you know how to fit and evaluate a scikit-learn model, use a train/test split, and interpret metrics such as R² or accuracy. Partial dependence (PD) is a model-agnostic method: it studies predictions without using the model’s internal structure.
One-way and two-way partial dependence
A one-way PD plot shows the model’s average prediction as one feature changes. For each grid value, the method replaces that feature in every row, predicts, and averages the results. The other features remain as observed.
Read the plot by checking:
- Direction: Does the average prediction rise or fall?
- Shape: Is the relationship linear, curved, flat, or threshold-like?
- Strength: How large is the vertical change?
- Range: Are conclusions limited to feature values supported by data?
A two-way PD plot varies two features together and displays the average prediction as a surface or contour map. Look for interaction: if the effect of one feature changes across the value of the other, their combined effect is not simply additive.
ICE curves: the individuals behind the average
An individual conditional expectation (ICE) curve repeats the one-feature PD calculation for one row at a time. Each curve shows how that row’s prediction changes. The average of all ICE curves is the PD curve.
ICE reveals hidden heterogeneity. Curves with different slopes suggest that the feature affects groups differently. Crossing curves often indicate interactions that an average curve hides.
Where partial dependence misleads
PD assumes that the varied feature can be combined with the other features independently. With correlated features, this can create unrealistic rows. For example, changing a home’s income while leaving an implausible occupancy value may produce predictions outside the training distribution.
PD also averages across rows. The average may describe no real individual, and extrapolation near the grid’s edges can be unstable. Use a central quantile range and inspect the data density.
Beyond these tools
- Conditional permutation preserves relationships among correlated features better than ordinary shuffling.
- Accumulated local effects (ALE) uses local changes and usually requires fewer unrealistic combinations.
- SHAP assigns contributions to individual predictions and can summarize them globally, but its results depend on the chosen feature-dependence assumptions.
A practical workflow: rank, then probe
- Use held-out permutation importance to rank features.
- Plot PD for the leading features.
- Inspect ICE curves for heterogeneous effects.
- Use two-way PD when interaction is plausible.
- Check correlations, data density, and validation performance before making claims.
Exercise
A PD curve rises overall, but half of its ICE curves fall. What should you conclude?
Show answer
The average effect is positive, but effects differ across observations. Investigate interactions or subgroups before treating the feature as uniformly beneficial.