code: def test_pair_confusion_matrix():
      # regular case: different non-trivial clusterings
      n = 10
      N = n**2
      clustering1 = np.hstack([[i + 1] * n for i in range(n)])
      clustering2 = np.hstack([[i + 1] * (n + 1) for i in range(n)])[:N]
      # basic quadratic implementation
      expected = np.zeros(shape=(2, 2), dtype=np.int64)
      for i in range(len(clustering1)):
          for j in range(len(clustering2)):
              if i != j:
                  same_cluster_1 = int(clustering1[i] == clustering1[j])
                  same_cluster_2 = int(clustering2[i] == clustering2[j])
                  expected[same_cluster_1, same_cluster_2] += 1
      assert_array_equal(
          pair_confusion_matrix(clustering1, clustering2), expected
      )
  
imports: import warnings
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal
  from sklearn.metrics.cluster import adjusted_mutual_info_score, adjusted_rand_score, completeness_score, contingency_matrix, entropy, expected_mutual_information, fowlkes_mallows_score, homogeneity_completeness_v_measure, homogeneity_score, mutual_info_score, normalized_mutual_info_score, pair_confusion_matrix, rand_score, v_measure_score
  from sklearn.metrics.cluster._supervised import _generalized_average, check_clusterings
  from sklearn.utils import assert_all_finite
  from sklearn.utils._testing import assert_almost_equal
label_desc: Use image node_id 25 for calling a global function with example usage: test_pair_confusion_matrix() without return types