Github user srowen commented on the issue: https://github.com/apache/spark/pull/15450 @sethah I should say I am not trying to handle cases where clusters start separate and converge to nearly the same point. I don't that's something we should even try to do. To elaborate, here are the relevant cases, I think. I'm ignoring cases where the data size is >> k because it all behaves as desired with high probability already. *Case 1*. Data = [A, B], k = 3, init = random Now, you'll get 3 centroids and definitely have a duplicate. After this change, you'd get 2. *Case 2*. Data = [A, A, B, B], k = 3, init = random Now, you'll get 3 centroids and definitely have a duplicate. After this change, same thing. *Case 3*. Data = [A, B, C, D], k = 3, init = random Now, you'll get 3 centroids and occasionally have a duplicate. After, this change, you'd get 3 distinct centroids always. *Case 4*. Data = [A, B], k = 3, init = parallel Now, you'll get 3 centroids and definitely have a duplicate. After this change, you should get 2 if I read the code right (that it won't pick a centroid at distance 0 from another). *Case 5*. Data = [A, A, B, B], k = 3, init = parallel Now, you'll get 3 centroids and definitely have a duplicate. After this change, you should get 2 for the same reason above. *Case 6*. Data = [A, B, C, D], k = 3, init = parallel Now, you'll get 3 centroids and occasionally have a duplicate. After this change, same thing. Case 1/4/5 are, I think, positive changes. Case 3 seems like a clear win. Case 2 could be made consistent with 1/4/5 easily, I suppose, by calling `.distinct`. Case 6 is the interesting one -- can we make it manage to return 3 distinct centroids always because that's clearly possible? like case 3? I punted on that though. I think Derrick's case is like 2 or 5. There are duplicates in the data and not many unique points. Filtering the duplicates early is a performance win. At least -- that is the case I am trying to solve. If that's not what is described in the JIRA then I think it's a different issue or question. I think there's a benefit to speed and meaningfulness of the model in case 1/2/4/5.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org