class_docstr: Implementation of the permutation feature importance for tabular datasets. The method measure the importance
  of a feature as the relative increase/decrease in the loss/score function when the feature values are permuted.
  Supports black-box models.
  
  For details of the method see the papers:
  
   - https://link.springer.com/article/10.1023/A:1010933404324
  
   - https://arxiv.org/abs/1801.01489
docstr: Helper function to compute the permutation feature importance for a given feature or tuple of features.
  
  Parameters
  ----------
  X, y, method, kind, n_repeats, sample_weight
      See :py:meth:`alibi.explainers.permutation_importance.PermutationImportance.explain`.#
  features
      The feature or the tuple of features to compute the permutation feature importance for.
  loss_orig
      Original loss value when the features are left intact. The loss is computed on the original datasets.
  score_orig
      Original score value when the feature are left intact. The score is computed on the original dataset.
  
  Returns
  --------
  A dictionary having as keys the metric names and as values the permutation feature importance associated
  with the corresponding metrics.
docstr_tok: ["Helper","function","to","compute","the","permutation","feature","importance","for","a","given","feature","or","tuple","of","features",".","Parameters","--","--","--","--","--","X",",","y",",","method",",","kind",",","n_repeats",",","sample_weight","See",":","py",":","meth",":","`","alibi.explainers.permutation_importance.PermutationImportance.explain","`",".","#","features","The","feature","or","the","tuple","of","features","to","compute","the","permutation","feature","importance","for",".","loss_orig","Original","loss","value","when","the","features","are","left","intact",".","The","loss","is","computed","on","the","original","datasets",".","score_orig","Original","score","value","when","the","feature","are","left","intact",".","The","score","is","computed","on","the","original","dataset",".","Returns","--","--","--","--","A","dictionary","having","as","keys","the","metric","names","and","as","values","the","permutation","feature","importance","associated","with","the","corresponding","metrics","."]
code: def _compute_permutation_importance(
      self,
      X: np.ndarray,
      y: np.ndarray,
      method: Literal["estimate", "exact"],
      kind: Literal["difference", "ratio"],
      n_repeats: int,
      sample_weight: Optional[np.ndarray],
      features: Union[int, Tuple[int, ...]],
      loss_orig: Dict[str, List[float]],
      score_orig: Dict[str, List[float]],
  ) -> Dict[str, Any]:
      """
      Helper function to compute the permutation feature importance for a given feature or tuple of features.
  
      Parameters
      ----------
      X, y, method, kind, n_repeats, sample_weight
          See :py:meth:`alibi.explainers.permutation_importance.PermutationImportance.explain`.#
      features
          The feature or the tuple of features to compute the permutation feature importance for.
      loss_orig
          Original loss value when the features are left intact. The loss is computed on the original datasets.
      score_orig
          Original score value when the feature are left intact. The score is computed on the original dataset.
  
      Returns
      --------
      A dictionary having as keys the metric names and as values the permutation feature importance associated
      with the corresponding metrics.
      """
      if method == Method.EXACT:
          # computation of the exact statistic which is quadratic in the number of samples
          return self._compute_exact(
              X=X,
              y=y,
              kind=kind,
              sample_weight=sample_weight,
              features=features,
              loss_orig=loss_orig,
              score_orig=score_orig,
          )
  
      # sample approximation
      return self._compute_estimate(
          X=X,
          y=y,
          kind=kind,
          n_repeats=n_repeats,
          sample_weight=sample_weight,
          features=features,
          loss_orig=loss_orig,
          score_orig=score_orig,
      )
  
imports: import copy
  import inspect
  import logging
  import math
  import numbers
  import sys
  from collections import defaultdict
  from copy import deepcopy
  from enum import Enum
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union, no_type_check
  import matplotlib.pyplot
  import numpy
  import sklearn.metrics
  from tqdm import tqdm
  from alibi.api.defaults import DEFAULT_DATA_PERMUTATION_IMPORTANCE, DEFAULT_META_PERMUTATION_IMPORTANCE
  from alibi.api.interfaces import Explainer, Explanation
label_desc: Use image node_id 6 for calling the PermutationImportance obj's underlying member method code with example usage: obj._compute_permutation_importance(X, y, method, kind, n_repeats, sample_weight, features, loss_orig, score_orig) and returns: self, self