One method for interpreting the relationship of a predictor X to the response variable Y in a fitted multivariate regression model is a Partial Effects (PE) Plot. This can be generated by holding other predictors constant at their mean or median (for continuous variables) or mode (for categorical variables), and plotting predictions of Y from the fitted model for various values of the predictor of interest X. (Frank Harrell's Biostatistical Modeling course notes have some information on how to do this: https://hbiostat.org/rmsc)

From reading the literature on the interpretation of Machine Learning models such as Random Forests, it appears that one of the most widely used methods for interpreting relationships between predictors and responses in fitted ML models is Partial Dependence Plots (PDPs), introduced by Jerome Friedman in 2001. The idea is similar to a Partial Effects plot but is subtly different. A PDP plots the change in the average predicted Y as X varies over its marginal distribution. Skipping over the mathematics, this is generated by generating a prediction for Y for each observation in the training set for some (perturbed) value of X, keeping other predictors as is, then averaging the results; generating predictions for Y for each training observation for the next perturbed value of X, then averaging the results; and so on for the range of values of interest for X. We then plot the averaged predictions over the range of values of X. (See Friedman's original paper here https://statweb.stanford.edu/~jhf/ftp/trebst.pdf and the summary in Elements of Statistical Learning pp.369-70).

My question is the following: it appears there is nothing in principle preventing us from generating a PE plot from a fitted ML model - we would simply generate a dataset with varying X and other predictors held constant at their means/modes, and then generate/plot the ML model predictions. What is the specific motivation for using PDPs for ML models? Is there something illegitimate about generating a PE plot from an ML model such as a Random Forest? I suspect it has something to do with the non-linearities and interactions that are captured by a Random Forest's predicted values, but it would be nice to capture this intuition more precisely.


1 Answer 1


For linear models without categorical variables, if you are using the mean when computing the PE plot, then the PE plot is the same as the PDP. Intuitively, the PE plot is to take the average for other variables first and then plot a curve, where the slope is the beta. The PDP is to compute the values for every instance and then take an average, where the slope is also the beta (see https://cran.r-project.org/web/packages/datarobot/vignettes/PartialDependence.html).

However, for linear models with categorical variables, using the mode for categorical variables cannot generate a curve with a slope equal to beta (since using mode to approximate the "mean" of categorical variables is not accurate enough). But PDP still can. I think here is where the difference lies. Obviously, PDP seems better in this sense.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.