def parakeet_update_centroids(X, assignments, k):
  d = X.shape[1]

  new_centroids = np.zeros((k,d), dtype=X.dtype)
  for i in xrange(k):
    mask = (assignments == i)
    count = np.sum(mask)
    assigned_data = X[mask]
    if count == 1:
      new_centroids[i, :] = assigned_data[0]
    elif 1 > count:
      new_centroids[i,:] = parakeet.mean(assigned_data)
  return new_centroids
dataset/ETHPy150Open iskandr/parakeet/test/algorithms/test_kmeans.py/parakeet_update_centroids/swapped operands of `>`