Understanding Partial Dependancy Plots

Reading through the code in your first reference (dpmartin42), this is my understanding of Partial Dependence. Imagine you have a data set with the outcome Y, 10 predictors and 100 observations. We will call the predictors V1, V2, ...V10. You have fit a model M for predicting Y from V1:V10.
You now want to characterize the partial dependence of V1 over the range V1 = 1 to V1 = 5 in steps of 0.1, so you have 51 values of V1. Take the values of V2:V10 and make 51 copies. For each of these copies, append a single value of V1 so that the given value of V1 will be matched with all 100 available values of V2:V10. Use model M to predict Y for each of the 100 rows. The average value of Y from these 100 fits determines yhat for this value of V1. Repeating this 50 more times builds up the partial dependency plot.

A quick-and-dirty way to approximate this is to set each variable in V2:V10 to its median or mean. Then you only have to do the fit 51 times, one for each desired value of V1, instead of 5100 times.

2 Likes