class_docstr: Meta-estimator which computes ``feature_importances_`` attribute
  based on permutation importance (also known as mean score decrease).
  
  :class:`~PermutationImportance` instance can be used instead of
  its wrapped estimator, as it exposes all estimator's common methods like
  ``predict``.
  
  There are 3 main modes of operation:
  
  1. cv="prefit" (pre-fit estimator is passed). You can call
     PermutationImportance.fit either with training data, or
     with a held-out dataset (in the latter case ``feature_importances_``
     would be importances of features for generalization). After the fitting
     ``feature_importances_`` attribute becomes available, but the estimator
     itself is not fit again. When cv="prefit",
     :meth:`~PermutationImportance.fit` must be called
     directly, and :class:`~PermutationImportance` cannot be used with
     ``cross_val_score``, ``GridSearchCV`` and similar utilities that clone
     the estimator.
  2. cv=None. In this case :meth:`~PermutationImportance.fit` method fits
     the estimator and computes feature importances on the same data, i.e.
     feature importances don't reflect importance of features for
     generalization.
  3. all other ``cv`` values. :meth:`~PermutationImportance.fit` method
     fits the estimator, but instead of computing feature importances for
     the concrete estimator which is fit, importances are computed for
     a sequence of estimators trained and evaluated on train/test splits
     according to ``cv``, and then averaged. This is more resource-intensive
     (estimators are fit multiple times), and importances are not computed
     for the final estimator, but ``feature_importances_`` show importances
     of features for generalization.
  
  Mode (1) is most useful for inspecting an existing estimator; modes
  (2) and (3) can be also used for feature selection, e.g. together with
  sklearn's SelectFromModel or RFE.
  
  Currently :class:`~PermutationImportance` works with dense data.
  
  Parameters
  ----------
  estimator : object
      The base estimator. This can be both a fitted
      (if ``prefit`` is set to True) or a non-fitted estimator.
  
  scoring : string, callable or None, default=None
      Scoring function to use for computing feature importances.
      A string with scoring name (see scikit-learn `docs`_) or
      a scorer callable object / function with signature
      ``scorer(estimator, X, y)``.
      If ``None``, the ``score`` method of the estimator is used.
  
      .. _docs: https://scikit-learn.org/stable/modules/model_evaluation.html#common-cases-predefined-values
  
  n_iter : int, default 5
      Number of random shuffle iterations. Decrease to improve speed,
      increase to get more precise estimates.
  
  random_state : integer or numpy.random.RandomState, optional
      random state
  
  cv : int, cross-validation generator, iterable or "prefit"
      Determines the cross-validation splitting strategy.
      Possible inputs for cv are:
  
          - None, to disable cross-validation and compute feature importances
            on the same data as used for training.
          - integer, to specify the number of folds.
          - An object to be used as a cross-validation generator.
          - An iterable yielding train/test splits.
          - "prefit" string constant (default).
  
      If "prefit" is passed, it is assumed that ``estimator`` has been
      fitted already and all data is used for computing feature importances.
  
  refit : bool
      Whether to fit the estimator on the whole data if cross-validation
      is used (default is True).
  
  Attributes
  ----------
  feature_importances_ : array
      Feature importances, computed as mean decrease of the score when
      a feature is permuted (i.e. becomes noise).
  
  feature_importances_std_ : array
      Standard deviations of feature importances.
  
  results_ : list of arrays
      A list of score decreases for all experiments.
  
  scores_ : array of float
      A list of base scores for all experiments (with no features permuted).
  
  estimator_ : an estimator
      The base estimator from which the :class:`~PermutationImportance`
      instance  is built. This is stored only when a non-fitted estimator
      is passed to the :class:`~PermutationImportance`, i.e when ``cv`` is
      not "prefit".
  
  rng_ : numpy.random.RandomState
      random state
class_docstr_tok: ["Meta-estimator","which","computes","``","feature_importances_","``","attribute","based","on","permutation","importance","(","also","known","as","mean","score","decrease",")",".",":","class",":","`","~PermutationImportance","`","instance","can","be","used","instead","of","its","wrapped","estimator",",","as","it","exposes","all","estimator","'s","common","methods","like","``","predict","``",".","There","are","3","main","modes","of","operation",":","1.","cv=","''","prefit","''","(","pre-fit","estimator","is","passed",")",".","You","can","call","PermutationImportance.fit","either","with","training","data",",","or","with","a","held-out","dataset","(","in","the","latter","case","``","feature_importances_","``","would","be","importances","of","features","for","generalization",")",".","After","the","fitting","``","feature_importances_","``","attribute","becomes","available",",","but","the","estimator","itself","is","not","fit","again",".","When","cv=","''","prefit","''",",",":","meth",":","`","~PermutationImportance.fit","`","must","be","called","directly",",","and",":","class",":","`","~PermutationImportance","`","can","not","be","used","with","``","cross_val_score","``",",","``","GridSearchCV","``","and","similar","utilities","that","clone","the","estimator",".","2.","cv=None",".","In","this","case",":","meth",":","`","~PermutationImportance.fit","`","method","fits","the","estimator","and","computes","feature","importances","on","the","same","data",",","i.e",".","feature","importances","do","n't","reflect","importance","of","features","for","generalization",".","3.","all","other","``","cv","``","values",".",":","meth",":","`","~PermutationImportance.fit","`","method","fits","the","estimator",",","but","instead","of","computing","feature","importances","for","the","concrete","estimator","which","is","fit",",","importances","are","computed","for","a","sequence","of","estimators","trained","and","evaluated","on","train\/test","splits","according","to","``","cv","``",",","and","then","averaged",".","This","is","more","resource-intensive","(","estimators","are","fit","multiple","times",")",",","and","importances","are","not","computed","for","the","final","estimator",",","but","``","feature_importances_","``","show","importances","of","features","for","generalization",".","Mode","(","1",")","is","most","useful","for","inspecting","an","existing","estimator",";","modes","(","2",")","and","(","3",")","can","be","also","used","for","feature","selection",",","e.g",".","together","with","sklearn","'s","SelectFromModel","or","RFE",".","Currently",":","class",":","`","~PermutationImportance","`","works","with","dense","data",".","Parameters","--","--","--","--","--","estimator",":","object","The","base","estimator",".","This","can","be","both","a","fitted","(","if","``","prefit","``","is","set","to","True",")","or","a","non-fitted","estimator",".","scoring",":","string",",","callable","or","None",",","default=None","Scoring","function","to","use","for","computing","feature","importances",".","A","string","with","scoring","name","(","see","scikit-learn","`","docs","`","_",")","or","a","scorer","callable","object","\/","function","with","signature","``","scorer","(","estimator",",","X",",","y",")","``",".","If","``","None","``",",","the","``","score","``","method","of","the","estimator","is","used",".","..","_docs",":","https",":","\/\/scikit-learn.org\/stable\/modules\/model_evaluation.html","#","common-cases-predefined-values","n_iter",":","int",",","default","5","Number","of","random","shuffle","iterations",".","Decrease","to","improve","speed",",","increase","to","get","more","precise","estimates",".","random_state",":","integer","or","numpy.random.RandomState",",","optional","random","state","cv",":","int",",","cross-validation","generator",",","iterable","or","``","prefit","''","Determines","the","cross-validation","splitting","strategy",".","Possible","inputs","for","cv","are",":","-","None",",","to","disable","cross-validation","and","compute","feature","importances","on","the","same","data","as","used","for","training",".","-","integer",",","to","specify","the","number","of","folds",".","-","An","object","to","be","used","as","a","cross-validation","generator",".","-","An","iterable","yielding","train\/test","splits",".","-","``","prefit","''","string","constant","(","default",")",".","If","``","prefit","''","is","passed",",","it","is","assumed","that","``","estimator","``","has","been","fitted","already","and","all","data","is","used","for","computing","feature","importances",".","refit",":","bool","Whether","to","fit","the","estimator","on","the","whole","data","if","cross-validation","is","used","(","default","is","True",")",".","Attributes","--","--","--","--","--","feature_importances_",":","array","Feature","importances",",","computed","as","mean","decrease","of","the","score","when","a","feature","is","permuted","(","i.e",".","becomes","noise",")",".","feature_importances_std_",":","array","Standard","deviations","of","feature","importances",".","results_",":","list","of","arrays","A","list","of","score","decreases","for","all","experiments",".","scores_",":","array","of","float","A","list","of","base","scores","for","all","experiments","(","with","no","features","permuted",")",".","estimator_",":","an","estimator","The","base","estimator","from","which","the",":","class",":","`","~PermutationImportance","`","instance","is","built",".","This","is","stored","only","when","a","non-fitted","estimator","is","passed","to","the",":","class",":","`","~PermutationImportance","`",",","i.e","when","``","cv","``","is","not","``","prefit","''",".","rng_",":","numpy.random.RandomState","random","state"]
code: def predict_proba(self, X):
      return self.wrapped_estimator_.predict_proba(X)
  
imports: from functools import partial
  from typing import List
  import numpy
  from sklearn.model_selection import check_cv
  from sklearn.utils.metaestimators import if_delegate_has_method
  from sklearn.utils import check_array, check_random_state
  from sklearn.base import BaseEstimator, MetaEstimatorMixin, clone, is_classifier
  from sklearn.metrics.scorer import check_scoring
  from eli5.permutation_importance import get_score_importances
  from eli5.sklearn.utils import pandas_available
label_desc: Use image node_id 10 for calling the PermutationImportance obj's underlying member method code with example usage: obj.predict_proba(X) and returns: self