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 method to build `Explanation` object.
  
  Parameters
  ----------
  feature_names
      List of names of the explained features.
  individual_feature_importance
      List of dictionary having as keys the names of the metric functions and as values the feature
      importance when ``kind='exact'`` or a dictionary containing the mean and the standard deviation of the
      feature importance, and the samples used to compute the two statistics when``kind='estimate'`` for
      the corresponding metrics.
  
  Returns
  -------
  `Explanation` object.
docstr_tok: ["Helper","method","to","build","`","Explanation","`","object",".","Parameters","--","--","--","--","--","feature_names","List","of","names","of","the","explained","features",".","individual_feature_importance","List","of","dictionary","having","as","keys","the","names","of","the","metric","functions","and","as","values","the","feature","importance","when","``","kind='exact","'","``","or","a","dictionary","containing","the","mean","and","the","standard","deviation","of","the","feature","importance",",","and","the","samples","used","to","compute","the","two","statistics","when","``","kind='estimate","'","``","for","the","corresponding","metrics",".","Returns","--","--","--","-","`","Explanation","`","object","."]
code: def _build_explanation(
      self,
      feature_names: List[Union[str, Tuple[str, ...]]],
      individual_feature_importance: List[
          Union[Dict[str, float], Dict[str, Dict[str, float]]]
      ],
  ) -> Explanation:
      """
      Helper method to build `Explanation` object.
  
      Parameters
      ----------
      feature_names
          List of names of the explained features.
      individual_feature_importance
          List of dictionary having as keys the names of the metric functions and as values the feature
          importance when ``kind='exact'`` or a dictionary containing the mean and the standard deviation of the
          feature importance, and the samples used to compute the two statistics when``kind='estimate'`` for
          the corresponding metrics.
  
      Returns
      -------
      `Explanation` object.
      """
      # list of metrics names
      metric_names = list(individual_feature_importance[0].keys())
  
      # list of lists of features importance, one list per loss function
      feature_importance: List[
          List[Union[float, Dict[str, float]]]
      ] = []
  
      for metric_name in metric_names:
          feature_importance.append([])
  
          for i in range(len(feature_names)):
              feature_importance[-1].append(
                  individual_feature_importance[i][metric_name]
              )
  
      data = copy.deepcopy(DEFAULT_DATA_PERMUTATION_IMPORTANCE)
      data.update(
          feature_names=feature_names,
          metric_names=metric_names,
          feature_importance=feature_importance,
      )
  
      return Explanation(meta=copy.deepcopy(self.meta), data=data)
  
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 11 for calling the PermutationImportance obj's underlying member method code with example usage: obj._build_explanation(feature_names, individual_feature_importance) and returns: Explanation