Learn R Programming

KOBT (version 0.1.0)

importance.score: Importance Score

Description

Generate SHAP (SHapley Additive exPlanations) and Saabas scores.

Usage

importance.score(fit, Y, X)

Arguments

fit

A fitted object of class xgb.Booster.

Y

A vector of responses.

X

An input design matrix.

Value

A list of (1) shap, a vector of Hapley Additive exPlanations for each feature; (2) saabas, a vector of an individualized heuristic feature attribution method, which can be considered as an approximation for shap.

References

candes2018panningKOBT chen2016xgboostKOBT lundberg2017unifiedKOBT

Examples

Run this code
# NOT RUN {
set.seed(10)
X <- matrix(rnorm(100), nrow = 10)
Y <- matrix(rnorm(10), nrow = 10)
dtrain <- xgboost::xgb.DMatrix(X, label = Y)
fit.model <- xgboost::xgb.train(data = dtrain, nrounds = 5)
tmp <- importance.score(fit = fit.model, Y = Y, X = X)

# }

Run the code above in your browser using DataLab