importance.score: Importance Score

Description Usage Arguments Value References Examples

View source: R/importance.score.R

Description

Generate SHAP (SHapley Additive exPlanations) and Saabas scores.

Usage

1
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

\insertRef

candes2018panningKOBT \insertRefchen2016xgboostKOBT \insertReflundberg2017unifiedKOBT

Examples

1
2
3
4
5
6
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)

KOBT documentation built on Feb. 20, 2020, 5:08 p.m.