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 multiple metrics.
  
  Parameters
  ----------
  metric_fns
      A dictionary of metric functions having as keys the names of the metric functions and as
      values the metric functions.
  y
      Ground truth targets.
  y_hat
      Predicted outcome as returned by the classifier.
  sample_weight
      Weight of each sample instance.
  
  Returns
  -------
  Dictionary having as keys the metric names and as values the evaluation of the metrics.
docstr_tok: ["Helper","function","to","compute","multiple","metrics",".","Parameters","--","--","--","--","--","metric_fns","A","dictionary","of","metric","functions","having","as","keys","the","names","of","the","metric","functions","and","as","values","the","metric","functions",".","y","Ground","truth","targets",".","y_hat","Predicted","outcome","as","returned","by","the","classifier",".","sample_weight","Weight","of","each","sample","instance",".","Returns","--","--","--","-","Dictionary","having","as","keys","the","metric","names","and","as","values","the","evaluation","of","the","metrics","."]
code: def _compute_metrics(
      metric_fns: Dict[
          str,
          Callable[
              [np.ndarray, np.ndarray, Optional[np.ndarray]], float
          ],
      ],
      y: np.ndarray,
      y_hat: np.ndarray,
      sample_weight: Optional[np.ndarray] = None,
  ) -> Dict[str, List[float]]:
      """
      Helper function to compute multiple metrics.
  
      Parameters
      ----------
      metric_fns
          A dictionary of metric functions having as keys the names of the metric functions and as
          values the metric functions.
      y
          Ground truth targets.
      y_hat
          Predicted outcome as returned by the classifier.
      sample_weight
          Weight of each sample instance.
  
      Returns
      -------
      Dictionary having as keys the metric names and as values the evaluation of the metrics.
      """
      metrics = defaultdict(list)
  
      for metric_name, metric_fn in metric_fns.items():
          metrics[metric_name].append(
              PermutationImportance._compute_metric(
                  metric_fn=metric_fn,
                  y=y,
                  y_hat=y_hat,
                  sample_weight=sample_weight,
              )
          )
      return metrics
  
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 4 for calling the PermutationImportance obj's underlying member method code with example usage: obj._compute_metrics(metric_fns, y, y_hat, sample_weight) and returns: metrics