code: def test_compute_importances_estimate_difference(lower_is_better):
      """Test if the computation of importance scores for multiple metrics is correct when `method='exact'`
      and `kind='difference'`."""
      metric_orig = {
          "metric_1": [np.random.uniform(1, 2)],
          "metric_2": [np.random.uniform(1, 2)],
      }
  
      metric_permuted = {
          "metric_1": np.random.uniform(1, 2, size=(4,)).tolist(),
          "metric_2": np.random.uniform(1, 2, size=(4,)).tolist(),
      }
  
      feature_importance = PermutationImportance._compute_importances(
          metric_orig=metric_orig,
          metric_permuted=metric_permuted,
          kind="difference",
          lower_is_better=lower_is_better,
      )
  
      for mn in metric_orig:
          samples = np.array(
              [mp - metric_orig[mn][0] for mp in metric_permuted[mn]]
          )
  
          if not lower_is_better:
              samples = -samples
  
          mean, std = samples.mean(), samples.std()
          assert np.allclose(mean, feature_importance[mn]["mean"])
          assert np.allclose(std, feature_importance[mn]["std"])
          assert np.allclose(samples, feature_importance[mn]["samples"])
  
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 12 for calling a global function with example usage: test_compute_importances_estimate_difference(lower_is_better) without return types