original_docstring: For each sample in each distribution, calculate the distance
          to each cluster (Euclidean distance), then find the minimum distance cluster index
          and add that point to that cluster.
  
      Args:
          parameters: see k_means.utils.mapping.Parameters for more details.
          data_eng: see k_means.core.data_prep.DataEng for more details.
  
      Returns:
          data_eng: since we change the clusters,
              we need to update the data_eng.cluster attribute and return data_eng.
      
docstring: For each sample in each distribution, calculate the distance
  to each cluster (Euclidean distance), then find the minimum distance cluster index
  and add that point to that cluster.
docstring_tokens: For each sample in each distribution calculate the distance to each cluster ( Euclidean distance ) then find the minimum distance cluster index and add that point to that cluster .
code: def calculate_distances(parameters: Parameters,
                          data_eng: DataEng) -> DataEng:
      """For each sample in each distribution, calculate the distance
          to each cluster (Euclidean distance), then find the minimum distance cluster index
          and add that point to that cluster.
  
      Args:
          parameters: see k_means.utils.mapping.Parameters for more details.
          data_eng: see k_means.core.data_prep.DataEng for more details.
  
      Returns:
          data_eng: since we change the clusters,
              we need to update the data_eng.cluster attribute and return data_eng.
      """
      # for each sample in each distribution...
      for dist in range(parameters.num_dists):
          for sample in range(parameters.num_samples):
              distances = []
              # for each sample, compute distance to each centroid
              try:
                  for cluster in range(parameters.num_clusters):
                      distances.append(
                          sqrt((data_eng.matrix_dists[dist][sample][0] - data_eng.centroids_prev[cluster][0]) ** 2 + (
                                  data_eng.matrix_dists[dist][sample][1] - data_eng.centroids_prev[cluster][1]) ** 2))
                  # find smallest distance
                  c_idx = np.array(distances).argmin()
                  # append sample, or point, to that cluster
                  data_eng.clusters[c_idx].append(data_eng.matrix_dists[dist][sample])
              except IndexError as index_expt:
                  print_detailed_exception(currentframe().f_code.co_name, sys.exc_info(), index_expt)
                  # would then store exception in the db
      # end of outer-most for loop
      return data_eng
code_tokens: def calculate_distances ( parameters : Parameters , data_eng : DataEng ) -> DataEng : for dist in range ( parameters . num_dists ) : for sample in range ( parameters . num_samples ) : distances = [ ] try : for cluster in range ( parameters . num_clusters ) : distances . append ( sqrt ( ( data_eng . matrix_dists [ dist ] [ sample ] [ 0 ] - data_eng . centroids_prev [ cluster ] [ 0 ] ) ** 2 + ( data_eng . matrix_dists [ dist ] [ sample ] [ 1 ] - data_eng . centroids_prev [ cluster ] [ 1 ] ) ** 2 ) ) c_idx = np . array ( distances ) . argmin ( ) data_eng . clusters [ c_idx ] . append ( data_eng . matrix_dists [ dist ] [ sample ] ) except IndexError as index_expt : print_detailed_exception ( currentframe ( ) . f_code . co_name , sys . exc_info ( ) , index_expt ) return data_eng
short_docstring: For each sample in each distribution, calculate the distance
  to each cluster (Euclidean distance), then find the minimum distance cluster index
  and add that point to that cluster.
short_docstring_tokens: For each sample in each distribution calculate the distance to each cluster ( Euclidean distance ) then find the minimum distance cluster index and add that point to that cluster .
comment: """For each sample in each distribution, calculate the distance
          to each cluster (Euclidean distance), then find the minimum distance cluster index
          and add that point to that cluster.
  
      Args:
          parameters: see k_means.utils.mapping.Parameters for more details.
          data_eng: see k_means.core.data_prep.DataEng for more details.
  
      Returns:
          data_eng: since we change the clusters,
              we need to update the data_eng.cluster attribute and return data_eng.
      """$SEP$# for each sample in each distribution...$SEP$# for each sample, compute distance to each centroid$SEP$# find smallest distance$SEP$# append sample, or point, to that cluster$SEP$# would then store exception in the db$SEP$# end of outer-most for loop