def uniform_labelings_scores(score_func, n_samples, n_clusters_range, fixed_n_classes=None, n_runs=5, seed=42):
 random_labels = np.random.RandomState(seed).randint
 scores = np.zeros((len(n_clusters_range), n_runs))
 if (fixed_n_classes is not None):
  labels_a = random_labels(low=0, high=fixed_n_classes, size=n_samples)
 for (i, k) in enumerate(n_clusters_range):
  for j in range(n_runs):
   if (fixed_n_classes is None):
    labels_a = random_labels(low=0, high=k, size=n_samples)
   labels_b = random_labels(low=0, high=k, size=n_samples)
   scores[(i, j)] = score_func(labels_a, labels_b)
 return scores

def uniform_labelings_scores ( score_func , n_samples , n_clusters_range , fixed_n_classes = None , n_runs = 5 , seed = 42 ) : random_labels = np . random . RandomState ( seed ) . randint scores = np . zeros ( ( len ( n_clusters_range ) , n_runs ) ) if ( fixed_n_classes is not None ) : labels_a = random_labels ( low = 0 , high = fixed_n_classes , size = n_samples ) for ( i , k ) in enumerate ( n_clusters_range ) : for j in range ( n_runs ) : if ( fixed_n_classes is None ) : labels_a = random_labels ( low = 0 , high = k , size = n_samples ) labels_b = random_labels ( low = 0 , high = k , size = n_samples ) scores [ ( i , j ) ] = score_func ( labels_a , labels_b ) return scores
compute score for 2 random uniform cluster labelings .