The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

pdp

r-universe version R-CMD-check Codecov test coverage R Journal

Partial dependence plots (PDPs) and individual conditional expectation (ICE) curves for R: visualize how a fitted model’s predictions depend on a subset of its features.

Installation

pdp is no longer available on CRAN due to CRAN’s stringent and ever-changing policies. It is now hosted on r-universe, which provides a reliable alternative for distributing R packages.

# Latest stable release (recommended)
install.packages("pdp", repos = c("https://bgreenwell.r-universe.dev", "https://cloud.r-project.org"))

# Or with pak
pak::pak("bgreenwell/pdp@main")  # latest stable release
pak::pak("bgreenwell/pdp")       # development version (devel branch)

Quick start

library(pdp)
library(randomForest)

data(boston)  # ships with pdp
set.seed(101)
rfo <- randomForest(cmedv ~ ., data = boston)

# Partial dependence of cmedv on lstat
pd <- partial(rfo, pred.var = "lstat", train = boston)
plot(pd, rug = TRUE, train = boston)

# Two predictors (false color level plot), restricted to the convex hull
partial(rfo, pred.var = c("lstat", "rm"), chull = TRUE, train = boston,
        plot = TRUE)

# ICE curves colored by another feature
ice <- partial(rfo, pred.var = "rm", ice = TRUE, train = boston)
plot(ice, alpha = 0.1, color.by = "lstat", train = boston)

partial() returns a plain data frame, so results are easy to post-process or plot with any graphics package.

Documentation

Development

Development happens on the devel branch (the repository default); main holds stable releases, which is what r-universe builds and the website documents. Please open pull requests against devel and report bugs via the issue tracker.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.