class_docstr: The class object for the Random Forest Plus (RF+) estimator, which can
  be used as a prediction model or interpreted via generalized
  mean decrease in impurity (MDI+). For more details, refer to [paper].
  
  Parameters
  ----------
  rf_model: scikit-learn random forest object or None
      The RF model to be used to build RF+. If None, then a new
      RandomForestRegressor() or RandomForestClassifier() is instantiated.
  prediction_model: A PartialPredictionModelBase object, scikit-learn type estimator, or "auto"
      The prediction model to be used for making (full and partial) predictions
      using the block transformed data.
      If value is set to "auto", then a default is chosen as follows:
       - For RandomForestPlusRegressor, RidgeRegressorPPM is used.
       - For RandomForestPlusClassifier, LogisticClassifierPPM is used.
  sample_split: string in {"loo", "oob", "inbag"} or None
      The sample splitting strategy to be used for fitting RF+. If "oob",
      RF+ is trained on the out-of-bag data. If "inbag", RF+ is trained on the
      in-bag data. Otherwise, RF+ is trained on the full training data.
  include_raw: bool
      Flag for whether to augment the local decision stump features extracted
      from the RF model with the original features.
  drop_features: bool
      Flag for whether to use an intercept model for the partial predictions
      on a given feature if a tree does not have any nodes that split on it,
      or to use a model on the raw feature (if include_raw is True).
  add_transformers: list of BlockTransformerBase objects or None
      Additional block transformers (if any) to include in the RF+ model.
  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.
docstr: Evaluate the stability of the MDI+ feature importance rankings
  across bootstrapped samples of trees. Can be used to select the GLM
  and scoring metric in a data-driven manner, where the GLM and metric, which
  yields the most stable feature rankings across bootstrapped samples is selected.
  
  Parameters
  ----------
  B: int
      Number of bootstrap samples.
  metrics: "auto" or a dict with functions as value and function name (str) as key
      Metric(s) used to evaluate the stability between two sets of feature importances.
      If "auto", then the feature importance stability metrics are:
          (1) Rank-based overlap (RBO) with p=0.9 (from "A Similarity Measure for
          Indefinite Rankings" by Webber et al. (2010)). Intuitively, this metric gives
          more weight to features with the largest importances, with most of the weight
          going to the ~1/(1-p) features with the largest importances.
          (2) A weighted kendall tau metric (tauAP_b from "The Treatment of Ties in
          AP Correlation" by Urbano and Marrero (2017)), which also gives more weight
          to the features with the largest importances, but uses a different weighting
          scheme from RBO.
      Note that these default metrics assume that a higher MDI+ score indicates
      greater importance and thus give more weight to these features with high
      importance/ranks. If a lower MDI+ score indicates higher importance, then invert
      either these stability metrics or the MDI+ scores before evaluating the stability.
  
  Returns
  -------
  stability_results: pd.DataFrame of shape (n_features, n_metrics)
      The stability scores of the MDI+ feature rankings across bootstrapped samples.
docstr_tok: ["Evaluate","the","stability","of","the","MDI+","feature","importance","rankings","across","bootstrapped","samples","of","trees",".","Can","be","used","to","select","the","GLM","and","scoring","metric","in","a","data-driven","manner",",","where","the","GLM","and","metric",",","which","yields","the","most","stable","feature","rankings","across","bootstrapped","samples","is","selected",".","Parameters","--","--","--","--","--","B",":","int","Number","of","bootstrap","samples",".","metrics",":","``","auto","''","or","a","dict","with","functions","as","value","and","function","name","(","str",")","as","key","Metric","(","s",")","used","to","evaluate","the","stability","between","two","sets","of","feature","importances",".","If","``","auto","''",",","then","the","feature","importance","stability","metrics","are",":","(","1",")","Rank-based","overlap","(","RBO",")","with","p=0.9","(","from","``","A","Similarity","Measure","for","Indefinite","Rankings","''","by","Webber","et","al",".","(","2010",")",")",".","Intuitively",",","this","metric","gives","more","weight","to","features","with","the","largest","importances",",","with","most","of","the","weight","going","to","the","~1\/","(","1-p",")","features","with","the","largest","importances",".","(","2",")","A","weighted","kendall","tau","metric","(","tauAP_b","from","``","The","Treatment","of","Ties","in","AP","Correlation","''","by","Urbano","and","Marrero","(","2017",")",")",",","which","also","gives","more","weight","to","the","features","with","the","largest","importances",",","but","uses","a","different","weighting","scheme","from","RBO",".","Note","that","these","default","metrics","assume","that","a","higher","MDI+","score","indicates","greater","importance","and","thus","give","more","weight","to","these","features","with","high","importance\/ranks",".","If","a","lower","MDI+","score","indicates","higher","importance",",","then","invert","either","these","stability","metrics","or","the","MDI+","scores","before","evaluating","the","stability",".","Returns","--","--","--","-","stability_results",":","pd.DataFrame","of","shape","(","n_features",",","n_metrics",")","The","stability","scores","of","the","MDI+","feature","rankings","across","bootstrapped","samples","."]
code: def get_mdi_plus_stability_scores(self, B=10, metrics="auto"):
      """
      Evaluate the stability of the MDI+ feature importance rankings
      across bootstrapped samples of trees. Can be used to select the GLM
      and scoring metric in a data-driven manner, where the GLM and metric, which
      yields the most stable feature rankings across bootstrapped samples is selected.
  
      Parameters
      ----------
      B: int
          Number of bootstrap samples.
      metrics: "auto" or a dict with functions as value and function name (str) as key
          Metric(s) used to evaluate the stability between two sets of feature importances.
          If "auto", then the feature importance stability metrics are:
              (1) Rank-based overlap (RBO) with p=0.9 (from "A Similarity Measure for
              Indefinite Rankings" by Webber et al. (2010)). Intuitively, this metric gives
              more weight to features with the largest importances, with most of the weight
              going to the ~1/(1-p) features with the largest importances.
              (2) A weighted kendall tau metric (tauAP_b from "The Treatment of Ties in
              AP Correlation" by Urbano and Marrero (2017)), which also gives more weight
              to the features with the largest importances, but uses a different weighting
              scheme from RBO.
          Note that these default metrics assume that a higher MDI+ score indicates
          greater importance and thus give more weight to these features with high
          importance/ranks. If a lower MDI+ score indicates higher importance, then invert
          either these stability metrics or the MDI+ scores before evaluating the stability.
  
      Returns
      -------
      stability_results: pd.DataFrame of shape (n_features, n_metrics)
          The stability scores of the MDI+ feature rankings across bootstrapped samples.
  
      """
      if self.mdi_plus_ is None:
          raise ValueError(
              "Need to compute MDI+ scores first using self.get_mdi_plus_scores(X, y)"
          )
      return self.mdi_plus_.get_stability_scores(B=B, metrics=metrics)
  
imports: import copy
  import numpy
  import pandas
  from sklearn.base import BaseEstimator, RegressorMixin, ClassifierMixin
  from sklearn.utils import check_array
  from sklearn.utils.validation import check_is_fitted
  from sklearn.metrics import r2_score, roc_auc_score, log_loss
  from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
  from sklearn.preprocessing import OneHotEncoder
  from imodels.importance.block_transformers import MDIPlusDefaultTransformer, TreeTransformer, CompositeTransformer, IdentityTransformer
  from imodels.importance.ppms import PartialPredictionModelBase, GlmClassifierPPM, RidgeRegressorPPM, LogisticClassifierPPM
  from imodels.importance.mdi_plus import ForestMDIPlus, _get_default_sample_split, _validate_sample_split, _get_sample_split_data
label_desc: Use image node_id 6 for calling the _RandomForestPlus obj's underlying member method code with example usage: obj.get_mdi_plus_stability_scores(B, metrics) and returns: self