class_docstr: A pure Python (slow) implementation of Tree SHAP.
      
class_docstr_tok: ["A","pure","Python","(","slow",")","implementation","of","Tree","SHAP","."]
code: def shap_interaction_values(self, X, tree_limit=-1, **kwargs):
      # shortcut using the C++ version of Tree SHAP in XGBoost and LightGBM
      if self.model_type == "xgboost":
          import xgboost
  
          if not str(type(X)).endswith("xgboost.core.DMatrix'>"):
              X = xgboost.DMatrix(X)
          if tree_limit == -1:
              tree_limit = 0
          return self.trees.predict(
              X, ntree_limit=tree_limit, pred_interactions=True
          )
      else:
          raise NotImplementedError(
              "Interaction values not yet supported for model type: "
              + str(type(X))
          )
  
file_path: shap/shap/explainers/pytree.py
imports: import numpy
  import pandas
  from ..utils._exceptions import ExplainerError
label_desc: Use image node_id 3 for calling the TreeExplainer obj's underlying member method code with example usage: obj.shap_interaction_values(X, tree_limit) and returns: self