Interface TreeSHAP

All Superinterfaces:
SHAP<Tuple>
All Known Implementing Classes:
AdaBoost, GradientTreeBoost, RandomForest, RandomForest

public interface TreeSHAP extends SHAP<Tuple>
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 Type
    Method
    Description
    Returns the formula associated with the model.
    default double[]
    Returns the average of absolute SHAP values over a data frame.
    default double[]
    Returns the SHAP values.
    Returns the decision trees.

    Methods inherited from interface smile.feature.importance.SHAP

    shap
  • 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

      default double[] shap(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 of p x k, where p is the number of features and k is the classes. The first k elements are the SHAP values of first feature over k classes, respectively. The rest features follow accordingly.
      Specified by:
      shap in interface SHAP<Tuple>
      Parameters:
      x - an instance.
      Returns:
      the SHAP values.
    • shap

      default double[] shap(DataFrame data)
      Returns the average of absolute SHAP values over a data frame.
      Parameters:
      data - the data.
      Returns:
      the average of absolute SHAP values.