View source: R/tree_explainer.R
| gazer | R Documentation |
Creates an explainer object for computing feature-specific Shapley values from a trained tree ensemble model. Supports XGBoost, LightGBM, and CatBoost models.
gazer(model, max_depth = NULL, base_score = NULL, ...)
model |
A model object of class |
max_depth |
Maximum depth of trees, extracted from |
base_score |
Base score for predictions, extracted from |
... |
Additional arguments, for future use |
A class of qshap_tree_explainer object containing the model information and
preprocessed tree structures for fast Shapley value computation
library(xgboost)
set.seed(42)
n <- 100
p <- 100
X <- matrix(rnorm(n * p), nrow = n, ncol = p)
y <- X[, 1] - X[, 2] + rnorm(n, sd = 0.2)
model <- xgboost(X, y, nrounds = 15, max_depth = 2, verbosity = 0, nthread = 1)
explainer <- gazer(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.