Package smile.feature.importance
Interface TreeSHAP
- All Known Implementing Classes:
AdaBoost
,GradientTreeBoost
,RandomForest
,RandomForest
SHAP of ensemble tree methods. TreeSHAP is a fast and exact method to
estimate SHAP values for tree models and ensembles of trees, under
several possible assumptions about feature dependence.
-
Method Details
-
trees
CART[] trees()Returns the decision trees.- Returns:
- the decision trees.
-
formula
Formula formula()Returns the formula associated with the model.- Returns:
- the model formula.
-
shap
Description copied from interface:SHAP
Returns the SHAP values. For regression, the length of SHAP values is same as the number of features. For classification, SHAP values are ofp x k
, wherep
is the number of features andk
is the classes. The first k elements are the SHAP values of first feature over k classes, respectively. The rest features follow accordingly. -
shap
Returns the average of absolute SHAP values over a data frame.- Parameters:
data
- the data.- Returns:
- the average of absolute SHAP values.
-