A partial dependence plot (PDP) shows how a black-box model’s prediction changes with a selected feature while averaging over the remaining features. It provides a global view of the learned relationship rather than explaining one individual prediction. section 9.0 section 9.3.2
Construct a PDP for feature Xk as follows:
- Choose a value a for the feature of interest. section 9.3.2
- Replace the entire Xk column with a, leaving every other feature unchanged. section 9.3.2
- Run the black-box model on this modified data set and average its predictions. section 9.3.2
- Repeat for multiple values of a and plot the resulting averages. section 9.3.2
The averaging operation approximates marginalization, or summing out, of the other features. Creating and evaluating a modified data set for every plotted value makes PDPs intuitive but potentially time consuming. Training-set data is recommended for visualization because the plot describes model behavior in terms of what the model learned. section 9.3.2
Bank marketing model
For a model trained on Bank Marketing data, PDPs can be generated for euribor3m, nr.employed, contact, and emp.var.rate. Scikit-learn’s PartialDependenceDisplay.from_estimator accepts the fitted estimator and training data, supports average plots, and can use predict_proba for classification responses. section 9.3.2

