code: def test_rand_score():
      # regular case: different non-trivial clusterings
      clustering1 = [0, 0, 0, 1, 1, 1]
      clustering2 = [0, 1, 0, 1, 2, 2]
      # pair confusion matrix
      D11 = 2 * 2  # ordered pairs (1, 3), (5, 6)
      D10 = 2 * 4  # ordered pairs (1, 2), (2, 3), (4, 5), (4, 6)
      D01 = 2 * 1  # ordered pair (2, 4)
      D00 = 5 * 6 - D11 - D01 - D10  # the remaining pairs
      # rand score
      expected_numerator = D00 + D11
      expected_denominator = D00 + D01 + D10 + D11
      expected = expected_numerator / expected_denominator
      assert_allclose(rand_score(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 27 for calling a global function with example usage: test_rand_score() without return types