loop_calculate_partial_dependency: Convenience function to calculate partial dependency over...

Description Usage Arguments Value Examples

Description

Loops through feature columns in a data.table and calculates partial dependency for each

Usage

1
2
3
loop_calculate_partial_dependency(feature_dt, model_list,
  feature_cols = names(feature_dt), predict_fcn = predict,
  ensemble_fcn = median, ...)

Arguments

feature_dt

data.table containing features used in predictive model

model_list

named list of model objects. Each name will become a column containing predictions from that model.

feature_cols

character vector of column names in feature_dt on which to calculate variable importance. Defaults to all columns in feature_dt

predict_fcn

function that accepts a model as its first argument and newdata as one of its named arguments

ensemble_fcn

function that combines a vector of predictions into a single ensemble. Default is median

...

additional arguments to pass to calculate_partial_dependency

Value

a list of data.tables returned by calculate_partial_dependency

Examples

1
2
3
4
5
6
7
8
## Not run: 
dt <- data.table(a = 1:3, b = 2:4, c = c(8, 11, 14))
m <- lm(c ~ a + b - 1, dt)
gm <- glm(c ~ a + b - 1, data = dt)
loop_calculate_partial_dependency(dt, feature_cols = c("a", "b"),
                                  model_list = list(lm1 = m), num_grid = 6)

## End(Not run)

breather/brightbox documentation built on May 13, 2019, 5:04 a.m.