09 — Understand Your Features

Partial Dependence & ICE#

Explainability✓ Mathematical
◆ The PatternHow does changing one feature affect predictions? PDP shows the average, ICE shows every instance

Partial Dependence Plots (PDP) show the average effect of one feature on predictions, marginalising over all other features. ICE plots show the same for each individual instance — revealing heterogeneity the average hides.

PD(xs) = (1/n) · Σ f(xs, xc(i))
PD = average prediction when feature s is fixed at xs, averaging over all other features.
// Interactive — PDP line with individual ICE curves
Show ICE
Instances20
# Python — PDP & ICE
from sklearn.inspection import PartialDependenceDisplay

# PDP with ICE
PartialDependenceDisplay.from_estimator(
    model, X_train,
    features=['age', 'income'],
    kind='both',      # PDP + ICE
    ice_lines_kw={'alpha': 0.1}
)
Interactions: If ICE lines cross each other, there's a feature interaction — the effect of this feature depends on other features' values. A flat PDP with scattered ICE means the average is misleading.
← Previous
Permutation Importance
Open in the full reader, with the topic sidebar →