Github user sethah commented on a diff in the pull request:
https://github.com/apache/spark/pull/15874#discussion_r87928721
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/feature/BucketedRandomProjectionLSH.scala
---
@@ -89,23 +90,25 @@ class RandomProjectionModel private[ml] (
}
@Since("2.1.0")
- override protected[ml] def hashDistance(x: Vector, y: Vector): Double = {
+ 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.toDense.values.zip(y.toDense.values).map(pair => math.abs(pair._1 -
pair._2)).min
+ x.zip(y).map(vectorPair => Vectors.sqdist(vectorPair._1,
vectorPair._2)).min
}
@Since("2.1.0")
override def copy(extra: ParamMap): this.type = defaultCopy(extra)
@Since("2.1.0")
- override def write: MLWriter = new
RandomProjectionModel.RandomProjectionModelWriter(this)
+ override def write: MLWriter = {
+ new
BucketedRandomProjectionModel.BucketedRandomProjectionModelWriter(this)
+ }
}
/**
* :: Experimental ::
*
- * This [[RandomProjection]] implements Locality Sensitive Hashing
functions for Euclidean
- * distance metrics.
+ * This [[BucketedRandomProjectionLSH]] implements Locality Sensitive
Hashing functions for
+ * Euclidean distance metrics.
*
* The input is dense or sparse vectors, each of which represents a point
in the Euclidean
* distance space. The output will be vectors of configurable dimension.
Hash value in the same
--- End diff --
"Hash values in the same dimension are calculated"
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]