class_docstr: A block transformer that transforms data using a representation built from
  local decision stumps from a tree or tree ensemble. The transformer also
  comes with metadata on the local decision stumps and methods that allow for
  transformations using sub-representations corresponding to each of the
  original features.
  
  Parameters
  ----------
  estimator: scikit-learn estimator
      The scikit-learn tree or tree ensemble estimator object.
  data: ndarray
      A data matrix that can be used to update the number of samples in each
      node of the tree(s) in the supplied estimator object. This affects
      the node values of the resulting engineered features.
class_docstr_tok: ["A","block","transformer","that","transforms","data","using","a","representation","built","from","local","decision","stumps","from","a","tree","or","tree","ensemble",".","The","transformer","also","comes","with","metadata","on","the","local","decision","stumps","and","methods","that","allow","for","transformations","using","sub-representations","corresponding","to","each","of","the","original","features",".","Parameters","--","--","--","--","--","estimator",":","scikit-learn","estimator","The","scikit-learn","tree","or","tree","ensemble","estimator","object",".","data",":","ndarray","A","data","matrix","that","can","be","used","to","update","the","number","of","samples","in","each","node","of","the","tree","(","s",")","in","the","supplied","estimator","object",".","This","affects","the","node","values","of","the","resulting","engineered","features","."]
code: def __init__(self, estimator, data=None):
      super().__init__()
      self.estimator = estimator
      self.oob_seed = self.estimator.random_state
      # Check if single tree or tree ensemble
      if isinstance(estimator, BaseEnsemble):
          tree_models = estimator.estimators_
          if data is not None:
              # If a data matrix is supplied, use it to update the number
              # of samples in each node
              for tree_model in tree_models:
                  _update_n_node_samples(tree_model, data)
      else:
          tree_models = [estimator]
      # Make stumps for each tree
      all_stumps = []
      for tree_model in tree_models:
          tree_stumps = make_stumps(tree_model.tree_)
          all_stumps += tree_stumps
      # Identify the stumps that split on feature k, for each k
      self.stumps = defaultdict(list)
      for stump in all_stumps:
          self.stumps[stump.feature].append(stump)
      self.n_splits = {
          k: len(stumps) for k, stumps in self.stumps.items()
      }
  
imports: from abc import ABC, abstractmethod
  import numpy
  from collections import defaultdict
  from sklearn.ensemble import BaseEnsemble
  from sklearn.ensemble._forest import _generate_unsampled_indices, _generate_sample_indices
  from .local_stumps import make_stumps, tree_feature_transform
label_desc: Use image node_id 1 to create a new TreeTransformer object from inherited base classes: BlockTransformerBase, ABC with example: obj = TreeTransformer(estimator, data)