code: def test_compute_exact(mocker):
      """Test if the exact computation generates the expected `N x (N - 1)` instances."""
      X = np.array(
          [
              [0, 3],
              [1, 4],
              [2, 5],
          ]
      )
      y = np.array([0, 1, 2])
      y_hat = np.array([0, 1, 2])
  
      X_expected = np.array(
          [
              [1, 3],
              [2, 3],
              [0, 4],
              [2, 4],
              [0, 5],
              [1, 5],
          ]
      )
      y_expected = np.array([0, 0, 1, 1, 2, 2])
      y_hat_expected = np.array(
          [1, 2, 0, 2, 0, 1]
      )  # first column in X_expected
  
      score_fns = {"accuracy": accuracy_score}
      score_orig = {
          "accuracy": [accuracy_score(y_true=y, y_pred=y_hat)]
      }
      pfi = PermutationImportance(
          predictor=lambda x: x[:, 0], score_fns=score_fns
      )
  
      mock_pred = mocker.patch.object(
          pfi, "predictor", wraps=pfi.predictor
      )
      mock_metrics = mocker.patch.object(
          PermutationImportance,
          "_compute_metrics",
          wraps=pfi._compute_metrics,
      )
      feature_importances = pfi._compute_exact(
          X=X,
          y=y,
          kind="difference",
          sample_weight=None,
          features=0,
          loss_orig={},
          score_orig=score_orig,
      )
  
      X_full = np.concatenate(
          [args_pred[0] for args_pred, _ in mock_pred.call_args_list]
      )
      assert np.allclose(X_full, X_expected)
  
      _, kwargs_metrics = mock_metrics.call_args
      assert np.allclose(y_expected, kwargs_metrics["y"])
      assert np.allclose(y_hat_expected, kwargs_metrics["y_hat"])
      assert np.isclose(feature_importances["accuracy"], 1)
  
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 13 for calling a global function with example usage: test_compute_exact(mocker) without return types