Example: biology

pdp: An R Package for Constructing Partial Dependence …

CONTRIBUTED RESEARCH ARTICLE421pdp: An R Package for ConstructingPartial Dependence Plotsby Brandon M. GreenwellAbstractComplex nonparametric models like neural networks, random forests, and support vectormachines are more common than ever in predictive analytics, especially when dealing with largeobservational databases that don t adhere to the strict assumptions imposed by traditional statisticaltechniques ( , multiple linear regression which assumes linearity, homoscedasticity, and normality).Unfortunately, it can be challenging to understand the results of such models and explain them tomanagement.

Wiener,2002) and gbm (Ridgeway,2017), among others; these are limited in the sense that they only apply to the models fit using the respective package. For example, the partialPlot function in randomForest only applies to objects of class "randomForest" and the plot function in gbm only applies to "gbm"objects.

Tags:

  2017, Senses, Packages, Partial, Constructing, Dependence, Package for constructing partial dependence

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of pdp: An R Package for Constructing Partial Dependence …

1 CONTRIBUTED RESEARCH ARTICLE421pdp: An R Package for ConstructingPartial Dependence Plotsby Brandon M. GreenwellAbstractComplex nonparametric models like neural networks, random forests, and support vectormachines are more common than ever in predictive analytics, especially when dealing with largeobservational databases that don t adhere to the strict assumptions imposed by traditional statisticaltechniques ( , multiple linear regression which assumes linearity, homoscedasticity, and normality).Unfortunately, it can be challenging to understand the results of such models and explain them tomanagement.

2 Partial Dependence plots offer a simple solution. Partial Dependence plots are low-dimensional graphical renderings of the prediction function so that the relationship between theoutcome and predictors of interest can be more easily understood. These plots are especially useful inexplaining the output from black box models. In this paper, we introducepdp, a general R packagefor Constructing Partial Dependence and Rubinfeld (1978) were among the first to analyze the well-known Boston housing of their goals was to find a housing value equation using data on median home values fromn=506census tracts in the suburbs of Boston from the 1970 census; see Harrison and Rubinfeld (1978,Table IV) for a description of each variable.

3 The data violate many classical assumptions like linearity,normality, and constant variance. Nonetheless, Harrison and Rubinfeld using a combination oftransformations, significance testing, and grid searches were able to find a reasonable fitting model(R2= ). Part of the payoff for there time and efforts was an interpretable prediction equationwhich is reproduced in Equation (1). log(MV)= + + 10 5 AGE log(D IS)+ log(R AD) 10 4 TAX AT IO+ (B )2 log(LSTAT) I M+ 10 5ZN+ 10 4I N DUS+ AS (1)Nowadays, many supervised learning algorithms can fit the data automatically in seconds typically with higher accuracy.

4 (We will revisit the Boston housing data in Section ) The downfall,however, is some loss of interpretation since these algorithms typically do not produce simple predic-tion formulas like Equation(1). These models can still provide insight into the data, but it is not in theform of simple equations. For example, quantifying predictor importance has become an essential taskin the analysis of "big data", and many supervised learning algorithms, like tree-based methods, cannaturally assign variable importance scores to all of the predictors in the training determining predictor importance is a crucial task in any supervised learning problem,ranking variables is only part of the story and once a subset of "important" features is identifiedit is often necessary to assess the relationship between them (or subset thereof)

5 And the can be done in many ways, but in machine learning it is often accomplished by constructingpartial Dependence plots(PDPs); see Friedman (2001) for details. PDPs help visualize the relationshipbetween a subset of the features (typically 1-3) and the response while accounting for the averageeffect of the other predictors in the model. They are particularly effective with black box models likerandom forests and support vector {x1,x2, .. ,xp}represent the predictors in a model whose prediction function is f(x). Ifwe partitionxinto an interest set,zs, and its compliment,zc=x\zs, then the " Partial Dependence " ofthe response onzsis defined asfs(zs)=Ezc[ f(zs,zc)]= f(zs,zc)pc(zc)dzc,(2)wherepc(zc)is the marginal probability density ofzc:pc(zc)= p(x)dzs.

6 Equation(2)can beestimated from a set of training data by fs(zs)=1nn i=1 f(zs,zi,c),(3)The R Journal Vol. 9/1, June 2017 ISSN 2073-4859 CONTRIBUTED RESEARCH ARTICLE422wherezi,c(i=1, 2, .. ,n)are the values ofzcthat occur in the training sample; that is, we average outthe effects of all the other predictors in the a PDP(3)in practice is rather straightforward. To simplify, letzs=x1be the predictorvariable of interest with unique values{x11,x12, .. ,x1k}. The Partial Dependence of the response onx1can be constructed as follows:1. Fori {1, 2, .. ,k}:(a)Copy the training data and replace the original values ofx1with the constantx1i.

7 (b) Compute the vector of predicted values from the modified copy of the trainingdata.(c) Compute the average prediction to obtain f1(x1i).2. Plot the pairs{x1i, f1(x1i)}fori=1, 2, .. , 1:A simple algorithm for Constructing the Partial Dependence of the responseon a single 1 can be quite computationally intensive since it involveskpasses over the trainingrecords. Fortunately, the algorithm can be parallelized quite easily (more on this in Section ). Itcan also be easily extended to larger subsets of two or more features as implementations of Friedman s PDPs are available in packagesrandomForest(Liaw andWiener, 2002) andgbm(Ridgeway, 2017 ), among others; these are limited in the sense that theyonly apply to the models fit using the respective Package .

8 For example, thepartialPlotfunctioninrandomForestonly applies to objects of class"randomForest"and theplotfunction ingbmonlyapplies to"gbm"objects. While therandomForestimplementation will only allow for a single predictor,thegbmimplementation can deal with any subset of the predictor space. Partial Dependence functionsare not restricted to tree-based models; they can be applied to any supervised learning algorithm( , generalized additive models and neural networks). However, to our knowledge, there is nogeneral Package for Constructing PDPs in R. For example, PDPs for a conditional random forest asimplemented by thecforestfunction in thepartyandpartykitpackages; see Hothorn et al.

9 ( 2017 )and Hothorn and Zeileis (2016), respectively. Thepdp(Greenwell, 2017 ) Package tries to close this gapby offering a general framework for Constructing PDPs that can be applied to several classes of (Milborrow, 2017b) is one alternative topdp. According to Milborrow,plotmoconstructs "a poor man s Partial Dependence plot." In particular, it plots a model s response whenvarying one or two predictors while holding the other predictors in the model constant (continuousfeatures are fixed at their median value, while factors are held at their first level). These plots allow forup to two variables at a time.

10 They are also less accurate than PDPs, but are faster to construct. Foradditive models ( , models with no interactions), these plots are identical in shape to PDPs. As ofplotmoversion , there is now support for Constructing PDPs, but it is not the default. The maindifference is thatplotmo, rather than applying step 1. (a)-(c) in Algorithm 1, accumulates all the dataat once thereby reducing the number of internal calls topredict. The trade-off is a slight increase inspeed at the expense of using more memory. So, why use thepdppackage? As will be discussed inthe upcoming sections,pdp: contains only a few functions with relatively few arguments; does notproduce a plot by default; can be used more efficiently with"gbm"objects (see Section ); produces graphics based onlattice(Sarkar, 2008), which are more flexible than base R graphics; defaults to using false color level plots for multivariate displays (see Section ); contains options to mitigate the risks associated with extrapolation (see Section ); has the option to display progress bars (see Section ).


Related search queries