class_docstr: This loads an XGBoost model directly from a raw memory dump.
  
  We can't use the JSON dump because due to numerical precision issues those
  tree can actually be wrong when feature values land almost on a threshold.
class_docstr_tok: ["This","loads","an","XGBoost","model","directly","from","a","raw","memory","dump",".","We","ca","n't","use","the","JSON","dump","because","due","to","numerical","precision","issues","those","tree","can","actually","be","wrong","when","feature","values","land","almost","on","a","threshold","."]
code: def get_trees(self, data=None, data_missing=None):
      shape = (self.num_trees, self.num_nodes.max())
      self.children_default = np.zeros(shape, dtype=int)
      self.features = np.zeros(shape, dtype=int)
      self.thresholds = np.zeros(shape, dtype=np.float32)
      self.values = np.zeros((shape[0], shape[1], 1), dtype=np.float32)
      trees = []
      for i in range(self.num_trees):
          for j in range(self.num_nodes[i]):
              if (
                  np.right_shift(self.node_sindex[i][j], np.uint32(31))
                  != 0
              ):
                  self.children_default[i, j] = self.node_cleft[i][j]
              else:
                  self.children_default[i, j] = self.node_cright[i][j]
              self.features[i, j] = self.node_sindex[i][j] & (
                  (np.uint32(1) << np.uint32(31)) - np.uint32(1)
              )
              if self.node_cleft[i][j] >= 0:
                  # Xgboost uses < for thresholds where shap uses <=
                  # Move the threshold down by the smallest possible increment
                  self.thresholds[i, j] = np.nextafter(
                      self.node_info[i][j], -np.float32(np.inf)
                  )
              else:
                  self.values[i, j] = self.node_info[i][j]
  
          k = len(self.node_cleft[i])
          trees.append(
              SingleTree(
                  {
                      "children_left": self.node_cleft[i],
                      "children_right": self.node_cright[i],
                      "children_default": self.children_default[i, :k],
                      "feature": self.features[i, :k],
                      "threshold": self.thresholds[i, :k],
                      "value": self.values[i, :k],
                      "node_sample_weight": self.sum_hess[i],
                  },
                  data=data,
                  data_missing=data_missing,
              )
          )
      return trees
  
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 2 for calling the XGBTreeModelLoader obj's underlying member method code with example usage: obj.get_trees(data, data_missing) and returns: trees