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","."]
docstr: Pull off the last column and keep it as our expected_value
docstr_tok: ["Pull","off","the","last","column","and","keep","it","as","our","expected_value"]
code: def _get_shap_interactions_output(self, phi, flat_output):
      """Pull off the last column and keep it as our expected_value"""
      if self.model.num_outputs == 1:
          self.expected_value = phi[0, -1, -1, 0]
          if flat_output:
              out = phi[0, :-1, :-1, 0]
          else:
              out = phi[:, :-1, :-1, 0]
      else:
          self.expected_value = [
              phi[0, -1, -1, i] for i in range(phi.shape[3])
          ]
          if flat_output:
              out = [
                  phi[0, :-1, :-1, i]
                  for i in range(self.model.num_outputs)
              ]
          else:
              out = [
                  phi[:, :-1, :-1, i]
                  for i in range(self.model.num_outputs)
              ]
      return out
  
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 8 for calling the TreeExplainer obj's underlying member method code with example usage: obj._get_shap_interactions_output(phi, flat_output) and returns: out