Description Usage Arguments Value Examples
Given a list of models, get their predictions over a range of
values from a specified feature. This is done by copying an input matrix X
several times and replacing a specified feature with different values for each copy.
The list of models then make predictions on this modified data.
| 1 2 3 4 | calculate_ice(feature_dt, feature_col, model_list, num_grid = 10,
  custom_range = NULL, predict_fcn = predict,
  ensemble_colname = "ensemble", ensemble_fcn = median,
  ensemble_models = names(model_list))
 | 
| feature_dt | data.table containing features used in predictive model | 
| feature_col | character. name of a column in  | 
| model_list | named list of model objects. Each name will become a column containing predictions from that model. | 
| num_grid | number of points to distribute along range of
 | 
| custom_range | should only be used if  | 
| predict_fcn | function that accepts a model as its first argument
and  | 
| ensemble_colname | character. Name of the column containing ensemble predictions | 
| ensemble_fcn | function that combines a vector of predictions into
a single ensemble. Default is  | 
| ensemble_models | character vector of names from model_list. These models will be combined by ensemble_fcn to form the ensemble | 
Output is a data.table of the same structure as feature_dt,
with several changes:
feature_dt is copied num_grid or length(custom_range) times
 the values in feature_col will have been modified
 new columns will have been added. One for each value in model_list
as well as ensemble_colname
 an id column will have been added to track observations
| 1 2 3 4 5 6 7 8 9 10 11 12 | ## 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)
calculate_ice(dt, "a", list(lm1 = m),
              num_grid = 6)
calculate_ice(dt, "a", list(lm1 = m, glm1 = gm),
              num_grid = 6, ensemble_fcn = sum)
calculate_ice(dt, "a", list(lm1 = m),
              num_grid = 6, custom_range = c(1,6))
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.