Individual Conditional Expectation (ICE)
Intuition
"What would the model predict for this person if only their age changed?" Keep everything else fixed, sweep one feature over a range, and plot the prediction. That curve is an ICE curve.
Precise explanation
For a model predict(X) -> (n,), an instance , feature and grid values :
build copies of , set column to in copy , and predict all copies in one batch.
Black-box: only predictions are needed, not model internals (model-agnostic). Caveat: if
features are correlated, some grid points create unrealistic inputs (e.g. 5 rooms in a 20 m² flat).
Figure (original): each line is one instance; different shapes reveal interactions that an average (PDP, XA-06) would hide.
Worked example
predict(X) = X[:,0]·X[:,1]; x = [2, 3]; vary feature 0 over [0, 1, 2] → [0, 3, 6] (slope = 3 = this instance's x₁ value).
Common mistakes
- Modifying the original instance in place.
- Calling the model once per grid point in a Python loop (slow for real models).
- Interpreting ICE as causal effects in the real world.
Why this matters
ICE curves are the building block of partial dependence (XA-06) and a practical "what-if" tool.
References
- Interpretable Machine Learning (3rd edition) — Christoph Molnar (
S024)