class_docstr: The class object for computing MDI+ feature importances for a single tree.
  Generalized mean decrease in impurity (MDI+) is a flexible framework for computing RF
  feature importances. For more details, refer to [paper].
  
  Parameters
  ----------
  estimator: a fitted PartialPredictionModelBase object or scikit-learn type estimator
      The fitted partial prediction model to use for evaluating
      feature importance via MDI+. If not a PartialPredictionModelBase, then
      the estimator is coerced into a PartialPredictionModelBase object via
      GenericRegressorPPM or GenericClassifierPPM depending on the specified
      task. Note that these generic PPMs may be computationally expensive.
  transformer: a BlockTransformerBase object
      A block feature transformer used to generate blocks of engineered
      features for each original feature. The transformed data is then used
      as input into the partial prediction models.
  scoring_fns: a function or dict with functions as value and function name (str) as key
      The scoring functions used for evaluating the partial predictions.
  sample_split: string in {"loo", "oob", "inbag"} or None
      The sample splitting strategy to be used when evaluating the partial
      model predictions. The default "loo" (leave-one-out) is strongly
      recommended for performance and in particular, for overcoming the known
      correlation and entropy biases suffered by MDI. "oob" (out-of-bag) can
      also be used to overcome these biases. "inbag" is the sample splitting
      strategy used by MDI. If None, no sample splitting is performed and the
      full data set is used to evaluate the partial model predictions.
  tree_random_state: int or None
      Random state of the fitted tree; used in sample splitting and
      only required if sample_split = "oob" or "inbag".
  mode: string in {"keep_k", "keep_rest"}
      Mode for the method. "keep_k" imputes the mean of each feature not
      in block k when making a partial model prediction, while "keep_rest"
      imputes the mean of each feature in block k. "keep_k" is strongly
      recommended for computational considerations.
  task: string in {"regression", "classification"}
      The supervised learning task for the RF model. Used for choosing
      defaults for the scoring_fns. Currently only regression and
      classification are supported.
  center: bool
      Flag for whether to center the transformed data in the transformers.
  normalize: bool
      Flag for whether to rescale the transformed data to have unit
      variance in the transformers.
code: def __init__(
      self,
      estimator,
      transformer,
      scoring_fns,
      sample_split="loo",
      tree_random_state=None,
      mode="keep_k",
      task="regression",
      center=True,
      normalize=False,
  ):
      assert sample_split in ["loo", "oob", "inbag", "auto", None]
      assert mode in ["keep_k", "keep_rest"]
      assert task in ["regression", "classification"]
      self.estimator = estimator
      self.transformer = transformer
      self.scoring_fns = scoring_fns
      self.sample_split = sample_split
      self.tree_random_state = tree_random_state
      _validate_sample_split(
          self.sample_split,
          self.estimator,
          isinstance(self.estimator, PartialPredictionModelBase),
      )
      if (
          self.sample_split in ["oob", "inbag"]
          and not self.tree_random_state
      ):
          raise ValueError(
              "Must specify tree_random_state to use 'oob' or 'inbag' sample_split."
          )
      self.mode = mode
      self.task = task
      self.center = center
      self.normalize = normalize
      self.is_fitted = False
      self._full_preds = None
      self.prediction_score_ = None
      self.feature_importances_ = None
  
imports: import numpy
  import pandas
  from scipy.spatial.distance import pdist
  from functools import partial
  from .ppms import PartialPredictionModelBase, GenericRegressorPPM, GenericClassifierPPM
  from .block_transformers import _blocked_train_test_split
  from .ranking_stability import tauAP_b, rbo
label_desc: Use image node_id 1 to create a new TreeMDIPlus object  with example: obj = TreeMDIPlus(estimator, transformer, scoring_fns, sample_split, tree_random_state, mode, task, center, normalize)