Changelog
Source:NEWS.md
pdp (development version)
Breaking changes
- Removed
topPredictors(), which had been deprecated since pdp 0.8.0; use the vip package to identify important predictors instead.
pdp 0.9.1
Deprecations
-
plotPartial()is deprecated in favor of the consolidatedplot()interface: theplot()methods gained alatticeargument, soplot(..., lattice = TRUE)now produces the same lattice-based displays (including 3-D wireframe surfaces and paneled three-predictor plots).plotPartial()continues to work (with a warning) but will be removed in a future release.
Bug fixes
Plotting now works for non-syntactic predictor names (e.g., names containing dashes or spaces) in both the tinyplot and lattice engines (#113).
partial(chull = TRUE)no longer fails for sparse ("dgCMatrix") training data (#77).Plotting multi-predictor output from
pred.fun(i.e., objects with ayhat.idcolumn and more than one predictor) now throws an informative error instead of producing a nonsense display (#111), (#112).Failing to recover the training data (e.g., for recent xgboost models when
trainis not supplied) now always produces the informative “please supply the training data” error rather than a crypticmatch.call()failure (#137).
New features
pred.varcan now be omitted wheneverpred.gridis supplied; it defaults tocolnames(pred.grid)(#122).New
fracargument inpartial()for randomly sampling a fraction of the training data before computing the partial dependence function; mostly useful for reducing the number of ICE curves and/or computation time (#74).New
color.byargument in theplot()methods for coloring ICE/c-ICE curves by another feature (#81).New
barsargument inplot.partial()for displaying factor predictors as bar plots instead of points (#132).exemplar()gained acatsargument for matrix-like objects so categorical columns are summarized by their most frequent value (rather than a rounded median); used bypartial(approx = TRUE)(#115).
pdp 0.9.0
Breaking changes
The ggplot2-based
autoplot()methods have been removed in favor of new, lightweight base Rplot()methods built on tinyplot. Consequently,partial()’splot.engineargument now accepts"tinyplot"in place of"ggplot2", and pdp no longer depends on ggplot2 or rlang."tinyplot"is now the default plotting engine forpartial(..., plot = TRUE); note that it draws the plot directly (as a side effect) and returns the data frame of partial dependence values invisibly. Useplot.engine = "lattice"for the previous behavior (i.e., a returned"trellis"object).
Bug fixes
Fixed a serious bug in the recursive (i.e., weighted tree traversal) method for
"gbm"objects that produced incorrect partial dependence values for factor predictors; the factor levels were passed to the underlying C++ routine using 1-based (rather than 0-based) integer codes, shifting each level’s value and reading out of bounds for the last level.partial()no longer errors for"gbm"objects fit with list-valued distributions (e.g.,distribution = list(name = "quantile", alpha = 0.5)).The convex hull displayed by
plotPartial(chull = TRUE)is now correct whenever the training data contain missing values.Conflicting grid options (e.g., specifying both
grid.resolutionandquantiles) now always throw an error, even when all of the predictors listed inpred.varare factors.Removed a stray
"FALSE"that was appended to the message displayed when requesting a progress bar with the recursive method.
New features
New tinyplot-based
plot()methods for"partial","ice", and"cice"objects; see?plot.partialfor details and examples.New
batch.sizeargument inpartial()for scoring multiple grid points per call topredict()(i.e., batching); this is often substantially faster than the default one-call-per-grid-point approach at the cost of additional memory. For example, trybatch.size = 1e6to score (roughly) one million rows per call.
Miscellaneous
foreach was moved from Imports to Suggests; it is now only required for parallel execution (i.e., whenever
parallel = TRUE).Removed unused packages from Suggests (keras, reticulate, and dplyr).
topPredictors()(which is deprecated) now throws an informative error when caret is not installed.Internal cleanup: the brute force method (
pardep()) was consolidated from four nearly identical loops into one, and the prediction wrappers inget_predictions.Rnow share a common helper.Fixed failing tests due to changes in the
xgboostpackage.
pdp 0.8.2
CRAN release: 2024-10-28
Minor changes
Set
R_NO_REMAPper changes in CRAN policies.Updated package documentation since
@docType "package"is deprecated.Removed unnecessary
get_training_data.Rdfile and cleaned up arguments.Update citation file to use
c()instead ofpersonList()andbibentry()instead ofcitEntry().
pdp 0.8.1
CRAN release: 2022-06-07
Bug fixes
- Fixed an ICE plot issue for XGBoost models caused by switching to the foreach package.
Breaking changes
-
partial()’s progress argument now only accepts a logical and defaults toFALSE.
pdp 0.8.0
CRAN release: 2022-05-11
New features
New (experimental) function
exemplar()for constructing an “exemplar” record from a data frame or matrix-like object. See?pdp::exemplarfor details (#91).partial()gained a new (experimental) feature via the newapproxargument. Ifapprox = TRUE, thenpartial()will compute predictions across the predictors specified inpred.varwhile holding the other predictors constant (a “poor man’s partial dependence” function as Stephen Milborrow, the author of plotmo, puts it). See?pdp::partialfor details.
Breaking changes
Bumped the R dependency to R (>= 3.6.0) to support the use of
grDevices::hcl.colors()inplotPartial().Function
grid.arrange()and the forward pipe operator%>%are no longer automatically imported from packages gridExtra and magrittr, respectively; users are encouraged to load them manually if needed.Removed the
paletteandalphaarguments fromplotPartial()andautoplot(); the latter just got absorbed into the...argument. By default,plotPartial()’scol.regionsargument now corresponds togrDevices::hcl.colors(100), which defaults to the same viridis color palette as before, just without the dependency.topPredictors()is now deprecated and will be removed in the next update. Users are advised to use the vip package instead.
Minor changes
Added support for gradient boosted Cox proportional hazards models in gbm.
-
Removed dependency on the retired plyr package by relying directly on the foreach package. Consequently, ICE curves (
ice = TRUE) are now slightly faster to compute (since the code refactoring avoids having to post-process ICE data from wide to long format) and the corresponding progress bar (progress = "text") is more honest.- As a further consequence, the
partial()function only supports a simple text-based progress bar (progress = "text"), but more options will possibly be added later.
- As a further consequence, the
Removed dependency on viridis; consequently, to keep the ‘viridis’ color palettes in
autoplot(), this required bumping the ggplot2 dependency to version 3.0.0, as well as some other code tweaks under the hood (#106).Removed dependency on mgcv by switching to an internal C implementation of mgcv’s
in.out()function (#107). (This is used behind the scenes wheneverpartial()is called withchull = TRUE.)"partial"is now a proper subclass of"data.frame"(#104); thanks to @RoelVerbelen for pointing this out.Fixed a bug where
rug = TRUEwould not work properly for xgboost models whenever callingpartial()withplot = TRUE.Fixed a bug in
partial()where thecatsargument was never actually passed topred_grid()(#86).Fixed a bug in
partial()for"gbm"objects whenrecursive = TRUEthat caused factors (including ordered factors) to be coerced to characters.
Miscellaneous
Switched from Travis-CI to GitHub Actions for continuous integration.
Refactored code for easier maintenance.
Switched to tinytest framework and increased test coverage (#84).
The internal function
get_training_data(), which is used to (attempt to) extract a fitted model’s training data whenevertrainis not specified, is (hopefully) a bit more flexible and robust in certain special cases(#90).Minor bug fixes in plotting functions (i.e.,
autoplot()andplotPartial()).Training data that inherits from class
"tibble"is still not officially supported, but shouldn’t cause as many errors from this point on.Using
autoplot()with a factor followed by numeric inpred.varno longer seems to be an issue (#79).
pdp 0.7.0
CRAN release: 2018-08-27
Added support for
e1071::naiveBayes(), an implementation of the standard naive Bayes classifier (#42).Fixed a bug in
plotPartial()that caused thecol.regionsargument to have no effect whenlevelplot = FALSE(#58).Fixed a bug with categorical variables in
gbmmodels whenrecursive = TRUE(#63).More informative progress bars (with estimated time to completion!!) powered by the
progresspackage. To use, simply callpartial()with the optionprogress = "progress"(#66).Added ORCiD ID to the author field in the
DESCRIPTIONfile.Way cooler logo?
partial()gained several new plotting options:plot.engine, which controls the plotting engine used wheneverplot = TRUE(current options include"lattice"(the default) and"ggplot2"(#71).The arguments to
autoplot()andplotPartial()are now more consistent with each other.The names of (most) helper functions have changed from lowerCamelCase to snake_case.
partial()now treats"xgb.Booster"objects withobjective = "reg:logistc"as regression (#68).Removed use of
ggplot2::aes_string()inautoplot()(which is soft deprecated as ofggplot2version 3.0.0) (#73).
pdp 0.6.0
CRAN release: 2017-07-20
Properly registered native routines and disabled symbol search.
Fixed a bug for
gbmmodels using the multinomial distribution.Refactored code to improve structure.
partial()gained three new options:inv.link(experimental),ice, andcenter. The latter two have to do with constructing individual conditional expectation (ICE) curves and centered ICE (c-ICE) curves. Theinv.linkoption is for transforming predictions from models that can use non-Gaussian distributions (e.g.,glm,gbm, andxgboost). Note that these options were added for convenience and the same results (plus much more) can still be obtained using the flexiblepred.funargument. (#36).plotPartial()gained five new options:center,plot.pdp,pdp.col,pdp.lwd, andpdp.lty; see?plotPartialfor details.Fixed default y-axis label for
autoplot()with two numeric predictors (#48).Added
CITATIONfile.Better support for neural networks from the
nnetpackage.Fixed a bug for
nnet::multinom()models with binary response.
pdp 0.5.2
CRAN release: 2017-03-13
Fixed minor pandoc conversion issue with
README.md.Added subdirectory called
toolsto hold figures forREADME.md.
pdp 0.5.0
Added support for
MASS::lda(),MASS::qda(), andmda::mars().New arguments
quantiles,probs, andtrim.outliersinpartial. These arguments make it easier to construct PDPs over the relevant range of a numeric predictor without having to specifypred.grid, especially when outliers are present in the predictors (which can distort the plotted relationship).The
trainargument can now accept matrices; in particular, object of class"matrix"or"dgCMatrix". This is useful, for example, when working with XGBoost models (i.e., objects of class"xgb.Booster").New logical argument
probindicating whether or not partial dependence values for classification problems should be returned on the original probability scale, rather than the centered logit; details for the centered logit can be found on page 370 in the second edition of The Elements of Statistical Learning.Fixed some typos in
NEWS.md.New function
autoplotfor automatically creatingggplot2graphics from"partial"objects.
pdp 0.4.0
CRAN release: 2017-01-07
partial()is now much faster with"gbm"object due to a call togbm::plot.gbm()wheneverpred.gridis not explicitly given by the user. (gbm::plot.gbm()exploits a computational shortcut that does not involve any passes over the training data.)New (experimental) function
topPredictors()for extracting the names of the most “important” predictors. This should make it one step easier (in most cases) to construct PDPs for the most “important”” features in a fitted model.A new argument,
pred.fun, allows the user to supply their own prediction function. Hence, it is possible to obtain PDPs based on the median, rather than the mean. It is also possible to obtain PDPs for classification problems on the probability scale. See?partialfor examples.Minor bug fixes and documentation tweaks.
pdp 0.3.0
CRAN release: 2016-12-18
The
...argument in the call topartial()now refers to additional arguments to be passed ontostats::predict()rather thanplyr::aaply(). For example, usingpartial()with"gbm"objects will require specification ofn.treeswhich can now simply be passed topartial()via the...argument.Added the following arguments to
partial():progress(plyr-based progress bars),parallel(plyr/foreach-based parallel execution), andparopts(list of additional arguments passed ontoforeachwhenparallel = TRUE).Various bug fixes.
partial()now throws an informative error message when thepred.gridargument refers to predictors not in the original training data.The column name for the predicted value has been changed from
"y"to"yhat".
pdp 0.2.0
CRAN release: 2016-12-03
randomForestis no longer imported.Added support for the
caretpackage (i.e., objects of class"train").Added example data sets:
boston(corrected Boston housing data) andpima(corrected Pima Indians diabetes data).Fixed error that sometimes occurred when
chull = TRUEcausing the convex hull to not be computed.Refactored
plotPartial()to be more modular.Added
gbmsupport for most non-"binomial"families`.