(eval_data, ref_data, num_clusters)
return eval_bins, ref_bins
Clusters the union of the data points and returns the cluster distribution.

  Clusters the union of eval_data and ref_data into num_clusters using minibatch
  k-means. Then, for each cluster, it computes the number of points from
  eval_data and ref_data.

  Args:
    eval_data: NumPy array of data points from the distribution to be evaluated.
    ref_data: NumPy array of data points from the reference distribution.
    num_clusters: Number of cluster centers to fit.

  Returns:
    Two NumPy arrays, each of size num_clusters, where i-th entry represents the
    number of points assigned to the i-th cluster.
Clusters the union of the data points and returns the cluster distribution.
Clusters the union of the data points and returns the cluster distribution .
def _cluster_into_bins(eval_data, ref_data, num_clusters):
  """Clusters the union of the data points and returns the cluster distribution.

  Clusters the union of eval_data and ref_data into num_clusters using minibatch
  k-means. Then, for each cluster, it computes the number of points from
  eval_data and ref_data.

  Args:
    eval_data: NumPy array of data points from the distribution to be evaluated.
    ref_data: NumPy array of data points from the reference distribution.
    num_clusters: Number of cluster centers to fit.

  Returns:
    Two NumPy arrays, each of size num_clusters, where i-th entry represents the
    number of points assigned to the i-th cluster.
  """

  cluster_data = np.vstack([eval_data, ref_data])
  kmeans = sklearn.cluster.MiniBatchKMeans(n_clusters=num_clusters, n_init=10)
  labels = kmeans.fit(cluster_data).labels_

  eval_labels = labels[:len(eval_data)]
  ref_labels = labels[len(eval_data):]

  eval_bins = np.histogram(eval_labels, bins=num_clusters,
                           range=[0, num_clusters], density=True)[0]
  ref_bins = np.histogram(ref_labels, bins=num_clusters,
                          range=[0, num_clusters], density=True)[0]
  return eval_bins, ref_bins
def _cluster_into_bins ( eval_data , ref_data , num_clusters ) : cluster_data = np . vstack ( [ eval_data , ref_data ] ) kmeans = sklearn . cluster . MiniBatchKMeans ( n_clusters = num_clusters , n_init = 10 ) labels = kmeans . fit ( cluster_data ) . labels_ eval_labels = labels [ : len ( eval_data ) ] ref_labels = labels [ len ( eval_data ) : ] eval_bins = np . histogram ( eval_labels , bins = num_clusters , range = [ 0 , num_clusters ] , density = True ) [ 0 ] ref_bins = np . histogram ( ref_labels , bins = num_clusters , range = [ 0 , num_clusters ] , density = True ) [ 0 ] return eval_bins , ref_bins