You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/02/02 08:46:40 UTC

[GitHub] [spark] zhengruifeng commented on a change in pull request #31394: [SPARK-34291][ML] LSH hashDistance optimization

zhengruifeng commented on a change in pull request #31394:
URL: https://github.com/apache/spark/pull/31394#discussion_r568419326



##########
File path: mllib/src/main/scala/org/apache/spark/ml/feature/BucketedRandomProjectionLSH.scala
##########
@@ -97,7 +97,19 @@ class BucketedRandomProjectionLSHModel private[ml](
   @Since("2.1.0")
   override protected[ml] def hashDistance(x: Seq[Vector], y: Seq[Vector]): Double = {
     // Since it's generated by hashing, it will be a pair of dense vectors.
-    x.zip(y).map(vectorPair => Vectors.sqdist(vectorPair._1, vectorPair._2)).min
+    // Currently each hash vector (generated by hashFunction) only has one element, this equals to:

Review comment:
       It is possible that a hash vector has length>1, but in current impl (since 2.1), each vector has only one value.




----------------------------------------------------------------
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.

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