liveBook · Manning

Partial dependence plot

As explained in Ensemble Methods for Machine Learning

A partial dependence function is the average model prediction obtained by fixing selected feature values and integrating or averaging over the remaining features.

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

How Ensemble Methods for Machine Learning covers it

How deep it goes
Defines marginalization and gives a stepwise approximation, while stopping short of formal integral details.
Examples
Uses Bank Marketing variables, column replacement, averaged predictions, and four plotted PDPs.
What it assumes
Assumes a fitted black-box model and feature data; teaches the averaging procedure from the model’s predictions.
What you can do after
Apply PDPs through scikit-learn’s PartialDependenceDisplay to visualize selected feature relationships.
How it connects
Contrasts with permutation feature importance and complements global surrogate models, LIME, SHAP, and glass-box models.

Also explained in

Compare how 2 books explain partial dependence plot →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Ensemble Methods for Machine Learning. The section links point to the parts of the book it draws on.