Package smile.feature.importance
Interface TreeSHAP
- All Superinterfaces:
SHAP<smile.data.Tuple>
- 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 Summary
Modifier and TypeMethodDescriptionsmile.data.formula.Formula
formula()
Returns the formula associated with the model.default double[]
shap
(smile.data.DataFrame data) Returns the average of absolute SHAP values over a data frame.default double[]
shap
(smile.data.Tuple x) Returns the SHAP values.CART[]
trees()
Returns the decision trees.
-
Method Details
-
trees
CART[] trees()Returns the decision trees.- Returns:
- the decision trees.
-
formula
smile.data.formula.Formula formula()Returns the formula associated with the model.- Returns:
- the model formula.
-
shap
default double[] shap(smile.data.Tuple x) 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
default double[] shap(smile.data.DataFrame data) Returns the average of absolute SHAP values over a data frame.- Parameters:
data
- the data.- Returns:
- the average of absolute SHAP values.
-