Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dependence

Partial Dependence


Description

Calculate partial dependence of a response on select predictor variables.

Usage

dependence(
  object,
  data = NULL,
  select = NULL,
  interaction = FALSE,
  n = 10,
  intervals = c("uniform", "quantile"),
  stats = MachineShop::settings("stats.PartialDependence")
)

Arguments

object

model fit result.

data

data frame containing all predictor variables. If not specified, the training data will be used by default.

select

expression indicating predictor variables for which to compute partial dependence (see subset for syntax) [default: all].

interaction

logical indicating whether to calculate dependence on the interacted predictors.

n

number of predictor values at which to perform calculations.

intervals

character string specifying whether the n values are spaced uniformly ("uniform") or according to variable quantiles ("quantile").

stats

function, function name, or vector of these with which to compute response variable summary statistics over non-selected predictor variables.

Value

PartialDependence class object that inherits from data.frame.

See Also

Examples

## Requires prior installation of suggested package gbm to run

gbm_fit <- fit(Species ~ ., data = iris, model = GBMModel)
(pd <- dependence(gbm_fit, select = c(Petal.Length, Petal.Width)))
plot(pd)

MachineShop

Machine Learning Models and Tools

v2.8.0
GPL-3
Authors
Brian J Smith [aut, cre]
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.