zhengruifeng commented on a change in pull request #28206: [SPARK-31436][ML] 
MinHash keyDistance optimization
URL: https://github.com/apache/spark/pull/28206#discussion_r407828815
 
 

 ##########
 File path: mllib/src/main/scala/org/apache/spark/ml/feature/MinHashLSH.scala
 ##########
 @@ -70,19 +70,51 @@ class MinHashLSHModel private[ml](
 
   @Since("2.1.0")
   override protected[ml] def keyDistance(x: Vector, y: Vector): Double = {
-    val xSet = x.nonZeroIterator.map(_._1).toSet
-    val ySet = y.nonZeroIterator.map(_._1).toSet
-    val intersectionSize = xSet.intersect(ySet).size.toDouble
-    val unionSize = xSet.size + ySet.size - intersectionSize
+    val xIter = x.nonZeroIterator.map(_._1)
 
 Review comment:
   Yes, the iterator here is in order and has unique indices

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to