zhengruifeng commented on a change in pull request #31313:
URL: https://github.com/apache/spark/pull/31313#discussion_r563463265
##########
File path:
mllib/src/main/scala/org/apache/spark/ml/feature/BucketedRandomProjectionLSH.scala
##########
@@ -60,14 +59,20 @@ private[ml] trait BucketedRandomProjectionLSHParams extends
Params {
* where `r_i` is the i-th random unit vector. The number of buckets will be
`(max L2 norm of input
* vectors) / bucketLength`.
*
- * @param randUnitVectors An array of random unit vectors. Each vector
represents a hash function.
+ * @param randMatrix A matrix with each row representing a hash function.
*/
@Since("2.1.0")
class BucketedRandomProjectionLSHModel private[ml](
override val uid: String,
- private[ml] val randUnitVectors: Array[Vector])
+ private[ml] val randMatrix: Matrix)
extends LSHModel[BucketedRandomProjectionLSHModel] with
BucketedRandomProjectionLSHParams {
+ private[ml] def this(uid: String, randUnitVectors: Array[Vector]) = {
+ this(uid, Matrices.fromVectors(randUnitVectors))
+ }
+
+ private[ml] def randUnitVectors: Array[Vector] = randMatrix.rowIter.toArray
Review comment:
add this constructor and method `randUnitVectors` for existing testsuites
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]