class_docstr: Uses Tree SHAP algorithms to explain the output of ensemble tree models.
  
  Tree SHAP is a fast and exact method to estimate SHAP values for tree models and ensembles of trees,
  under several different possible assumptions about feature dependence. It depends on fast C++
  implementations either inside an external model package or in the local compiled C extension.
class_docstr_tok: ["Uses","Tree","SHAP","algorithms","to","explain","the","output","of","ensemble","tree","models",".","Tree","SHAP","is","a","fast","and","exact","method","to","estimate","SHAP","values","for","tree","models","and","ensembles","of","trees",",","under","several","different","possible","assumptions","about","feature","dependence",".","It","depends","on","fast","C++","implementations","either","inside","an","external","model","package","or","in","the","local","compiled","C","extension","."]
code: def __call__(
      self, X, y=None, interactions=False, check_additivity=True
  ):
      start_time = time.time()
  
      if isinstance(X, pd.DataFrame):
          feature_names = list(X.columns)
      else:
          feature_names = getattr(self, "data_feature_names", None)
  
      if not interactions:
          v = self.shap_values(
              X,
              y=y,
              from_call=True,
              check_additivity=check_additivity,
              approximate=self.approximate,
          )
          if isinstance(v, list):
              v = np.stack(v, axis=-1)  # put outputs at the end
      else:
          assert (
              not self.approximate
          ), "Approximate computation not yet supported for interaction effects!"
          v = self.shap_interaction_values(X)
  
      # the Explanation object expects an `expected_value` for each row
      if (
          hasattr(self.expected_value, "__len__")
          and len(self.expected_value) > 1
      ):
          # `expected_value` is a list / array of numbers, length k, e.g. for multi-output scenarios
          # we repeat it N times along the first axis, so ev_tiled.shape == (N, k)
          if isinstance(v, list):
              num_rows = v[0].shape[0]
          else:
              num_rows = v.shape[0]
          ev_tiled = np.tile(self.expected_value, (num_rows, 1))
      else:
          # `expected_value` is a scalar / array of 1 number, so we simply repeat it for every row in `v`
          # ev_tiled.shape == (N,)
          ev_tiled = np.tile(self.expected_value, v.shape[0])
  
      # cf. GH dsgibbons#66, this conversion to numpy array should be done AFTER
      # calculation of shap values
      if isinstance(X, pd.DataFrame):
          X = X.values
      elif safe_isinstance(X, "xgboost.core.DMatrix"):
          import xgboost
  
          if version.parse(xgboost.__version__) < version.parse(
              "1.7.0"
          ):  # pragma: no cover
              # cf. GH #3357
              wmsg = (
                  "`shap.Explanation` does not support `xgboost.DMatrix` objects for xgboost < 1.7, "
                  "so the `data` attribute of the `Explanation` object will be set to None. If "
                  "you require the `data` attribute (e.g. using `shap.plots`), then either "
                  "update your xgboost to >=1.7.0 or explicitly set `Explanation.data = X`, where "
                  "`X` is a numpy or scipy array."
              )
              warnings.warn(wmsg)
              X = None
          else:
              X: scipy.sparse.csr_matrix = X.get_data()
  
      return Explanation(
          v,
          base_values=ev_tiled,
          data=X,
          feature_names=feature_names,
          compute_time=time.time() - start_time,
      )
  
imports: import json
  import os
  import struct
  import time
  import warnings
  import numpy
  import pandas
  import scipy.sparse
  import scipy.special
  from packaging import version
  from ..None import maskers
  from .._explanation import Explanation
  from ..utils import assert_import, record_import_error, safe_isinstance
  from ..utils._exceptions import DimensionError, ExplainerError, InvalidFeaturePerturbationError, InvalidMaskerError, InvalidModelError
  from ..utils._legacy import DenseData
  from ._explainer import Explainer
label_desc: Use image node_id 3 for calling the TreeExplainer obj's underlying member method code with example usage: obj.__call__(X, y, interactions, check_additivity) and returns: Explanation