View source: R/set_reference_dataset.R
| set_reference_dataset | R Documentation |
Change a dataset used as reference for calculating SHAP values.
Reference dataset is initially set with data argument in unifying function.
Usually reference dataset is dataset used to train the model.
Important property of reference dataset is that SHAP values for each observation add up to its deviation from mean prediction for a reference dataset.
set_reference_dataset(unified_model, x)
unified_model |
Unified model representation of the model created with a (model).unify function. ( |
x |
Reference dataset. A |
model_unified.object. Unified representation of the model as created with a (model).unify function,
but with changed reference dataset (Cover column containing updated values).
lightgbm.unify for LightGBM models
gbm.unify for GBM models
xgboost.unify for XGBoost models
ranger.unify for ranger models
randomForest.unify for randomForest models
library(gbm)
data <- fifa20$data[colnames(fifa20$data) != 'work_rate']
data['value_eur'] <- fifa20$target
gbm_model <- gbm::gbm(
formula = value_eur ~ .,
data = data,
distribution = "laplace",
n.trees = 20,
interaction.depth = 4,
n.cores = 1)
unified <- gbm.unify(gbm_model, data)
set_reference_dataset(unified, data[200:700, ])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.