You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "wenwj0 (via GitHub)" <gi...@apache.org> on 2023/05/31 13:20:07 UTC

[GitHub] [spark] wenwj0 commented on a diff in pull request #41384: [SPARK-43297][ML]Use scala parallel collection ParVector to accelarate LocalKMeans.

wenwj0 commented on code in PR #41384:
URL: https://github.com/apache/spark/pull/41384#discussion_r1211708341


##########
mllib/src/main/scala/org/apache/spark/mllib/clustering/LocalKMeans.scala:
##########
@@ -46,7 +47,9 @@ private[mllib] object LocalKMeans extends Logging {
 
     // Initialize centers by sampling using the k-means++ procedure.
     centers(0) = pickWeighted(rand, points, weights).toDense
-    val costArray = points.map(EuclideanDistanceMeasure.fastSquaredDistance(_, centers(0)))
+    val pointsParVector = new ParVector(points.toVector)

Review Comment:
   Thanks for reply, I think the benefits of parallelism outweigh the costs of vector copying.
   It's not easy to find the threshold, because the points are two-dimensionsal.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org