Chapter 3: Feature Effects

Feature Effects indicate the change in prediction due to changes in feature values. This chapter explains the feature effects methods ICE curves, PDP and ALE plots.

§3.01: Introduction to Feature Effects



§3.02: Individual Conditional Expectation (ICE) Plots


Individual Conditional Expectation (ICE) plots are a model-agnostic method used to visualize how the prediction for a single observation changes as a subset specific features varies, while all other features for that observation are held constant. They offer a local interpretation, showing the effect of a feature for an individual instance.

Construction of ICE Curves

The construction of ICE curves involves the following steps for each observation $i$, and features of interest $x_S$

  1. Grid Point Generation: A set of grid values ${ x_S^{(1)},x_S^{(2)},…,x_S^{(g)} }$ is created for the feature of interest. These grid points span the range of $x_S$. Common methods for selecting grid values include equidistant, random sampling from observed feature values, quantiles of observed feature values with the latter two preserving the marginal distribution. However even these can create unrealistic datapoints if there are interactions especially (for example summer and temperature of -1 could be an impossible observation).

  2. Prediction: For each grid value $x_S^{(k)}$, new artificial datapoints are created by replacing the original values, while keeping the all other feature values $x_{-S}$ fixed. The models prediction $(x_S, f(x_S, x_{-S}))$ is calculated for each of these artificial points.
  3. Visualization: These points are then plotted and and they are connected to form the ICE curve for $i^{th}$ observation.

    Illustration of ICE Curves


§3.03: Partial Dependence (PD) Plot


Partial Dependence Plots (PDPs) are a model-agnostic method that visualizes the average marginal effect of one or two features on the predicted outcome of a machine learning model. They provide a global interpretation by showing how, on average, the model’s prediction changes as the feature(s) of interest vary, while averaging out the effects of all other features

PDP plots average ICE curves and thus may obscure heterogenous effects. Therefore it is important to plot both the ICE curves and the PDP together to detect these.

Illustration of PD with Interactions

Centered ICE PLots

Centered ICE Plots


§3.04: Marginal Effects

Marginal effects (MEs) quantify changes in model predictions resulting from changes in one or more features. They are particularly useful when parameter-based interpretations (like coefficients in linear models) are not straightforward due to model complexity or interactions.

There are two main ways to compute marginal effects:

  1. Derivative Marginal Effects (dMEs): These are numerical derivatives representing the slope of the tangent to the prediction function at a given point. They require the model to be differentiable (and therefore fails for stepwise models like Tree Ensembles, RuleFit, etc) and provide a rate of change of the prediction with respect to the feature value.
  2. Forward Marginal Effects (fMEs): These use finite forward differences, i.e., the difference in predictions when the feature is increased by a small step $h$. This approach does not require differentiability and works for any model and feature type.

Both methods measure the local effect of a feature on the prediction, but they differ in their assumptions and robustness.

Derivative Marginal Effects (dMEs)

Forward Marginal Effects (fMEs)

ME for Categorical Features

Traditionally a reference category was fixed, and the ME was calculated by keeping all other features constant except changing the category. The definition for fME mirrors the continuous equivalent:

\[fME_j(x; x_j^{new}) = \hat{f}(x_j^{new}, x_{-j}) - \hat{x_j, x_{-j}}\]

More on Marginal Effects

Local Instantiations

Average Marginal Effect (AME)

Why MEs are Still meaningful

MEs provide a single scalar number to quantify the effect. Simultaneously perturbing multiple features still yields a scalar. Moreover it is captured at the actual data point and captures interactions without any assumptions, provides a non-linearity measure and is computationally cheap.


§3.05: Accumulated Local Effect (ALE) Plot


PDP Shortcomings

M-Plots

TO-DO: ALE Plots

ALE attempts to solve this problem by taking partial derivatives (local effects) of prediction function w.r.t. feature of interest and integrating (accumulate) them w.r.t. the same feature.