code: def homogeneity(labels1, labels2):
      num_missed = 0.0
      for label in set(labels1):
          matches = labels2[labels1 == label]
          try:
              match_mode, mode_count = mode(matches, keepdims=True)
          except:
              match_mode, mode_count = mode(matches)
          num_missed += np.sum(matches != match_mode[0])
  
      for label in set(labels2):
          matches = labels1[labels2 == label]
          try:
              match_mode, mode_count = mode(matches, keepdims=True)
          except:
              match_mode, mode_count = mode(matches)
          num_missed += np.sum(matches != match_mode[0])
  
      return num_missed / 2.0
  
imports: import numpy
  from scipy.spatial import distance
  from scipy import sparse
  from scipy import stats
  from sklearn.utils.estimator_checks import check_estimator
  from sklearn.utils._testing import assert_array_equal, assert_array_almost_equal, assert_raises
  from hdbscan import HDBSCAN, hdbscan, validity_index, approximate_predict, approximate_predict_scores, membership_vector, all_points_membership_vectors
  from sklearn.datasets import make_blobs
  from sklearn.utils import shuffle
  from sklearn.preprocessing import StandardScaler
  from scipy.stats import mode
  from tempfile import mkdtemp
  from functools import wraps
  import pytest
  from sklearn import datasets
  import warnings
label_desc: Use image node_id 6 for calling a global function with example usage: homogeneity(labels1, labels2) and returns: unknown