MerQuR+Statistics Glossary

Statistics Glossary → Partial dependence plot

Partial dependence plotconcept

A plot showing how a machine-learning model's average prediction changes as one predictor is varied, averaging over the effects of the other predictors.

Models such as random forests, gradient boosting and neural networks have no individual coefficients, so how a variable affects the prediction cannot be read off directly. A partial dependence plot (PDP) answers this by giving the variable of interest a series of values; for each value it fixes that variable at that value for every observation in the data, leaves the other variables as they are, and averages the model's predictions. The resulting curve shows the variable's average marginal effect in the model, revealing whether it is linear, has a threshold or levels off.

The plot shows what the model has learned, not the causal effect in the real world. When variables are strongly correlated, it can mislead by making predictions for combinations that never occur in the data (say, a 20-year-old with 40 years of experience); accumulated local effects (ALE) plots are more reliable in that case. Averaging can also hide effects that go in opposite directions for different observations; individual conditional expectation (ICE) curves reveal such heterogeneity.

An everyday example

An estate agency predicts house prices with a random forest. The partial dependence plot for distance to the city centre shows the predicted price falling steeply over the first 5 km and then staying almost flat. This reveals that the model has learned that being close to the centre matters only up to a certain distance.

In MerQur

In Random Forest, the 'Additional output (imbalanced-data metrics, partial dependence)' option gives PDP/ICE curves and the 'Chart' can draw the PDP. In Support Vector Machine, Gradient Boosting, Decision Tree and Neural Network, the 'Partial dependence' option produces an extra table and chart; in classification the Support Vector Machine uses the Platt probability for partial dependence.

Analyses where this concept appears

Random ForestSupport Vector Machine (SVM)Gradient BoostingDecision Tree (CART)Neural Network (MLP)

Related concepts

SHAP valuesPermutation importance