code: def test_compute_metrics(dataset):
      """Test if the computation of multiple metrics is correct."""
      y_true = dataset["classification"]["y_true"]
      y_pred = dataset["classification"]["y_pred"]
      sample_weight = dataset["sample_weight"]
  
      metrics_fns = {
          "accuracy": accuracy_score,
          "f1": f1_score,
      }
  
      metrics = PermutationImportance._compute_metrics(
          metric_fns=metrics_fns,
          y=y_true,
          y_hat=y_pred,
          sample_weight=sample_weight,
      )
  
      expected_accuracy = accuracy_score(
          y_true=y_true, y_pred=y_pred, sample_weight=sample_weight
      )
  
      expected_f1 = f1_score(
          y_true=y_true, y_pred=y_pred, sample_weight=sample_weight
      )
  
      assert np.isclose(expected_accuracy, metrics["accuracy"])
      assert np.isclose(expected_f1, metrics["f1"])
  
imports: import re
  from copy import deepcopy
  import matplotlib.pyplot
  import numpy
  import pytest
  from pytest_lazyfixture import lazy_fixture
  from sklearn.metrics import accuracy_score, f1_score, max_error
  from alibi.api.defaults import DEFAULT_DATA_PERMUTATION_IMPORTANCE, DEFAULT_META_PERMUTATION_IMPORTANCE
  from alibi.api.interfaces import Explanation
  from alibi.explainers import PermutationImportance, plot_permutation_importance
label_desc: Use image node_id 8 for calling a global function with example usage: test_compute_metrics(dataset) without return types