Github user Yunni commented on a diff in the pull request: https://github.com/apache/spark/pull/15874#discussion_r89215190 --- Diff: mllib/src/main/scala/org/apache/spark/ml/feature/MinHashLSH.scala --- @@ -112,25 +116,26 @@ class MinHash(override val uid: String) extends LSH[MinHashModel] with HasSeed { override def setOutputCol(value: String): this.type = super.setOutputCol(value) @Since("2.1.0") - override def setOutputDim(value: Int): this.type = super.setOutputDim(value) + override def setNumHashTables(value: Int): this.type = super.setNumHashTables(value) @Since("2.1.0") def this() = { - this(Identifiable.randomUID("min hash")) + this(Identifiable.randomUID("mh-lsh")) } /** @group setParam */ @Since("2.1.0") def setSeed(value: Long): this.type = set(seed, value) @Since("2.1.0") - override protected[ml] def createRawLSHModel(inputDim: Int): MinHashModel = { - require(inputDim <= MinHash.prime / 2, - s"The input vector dimension $inputDim exceeds the threshold ${MinHash.prime / 2}.") + override protected[ml] def createRawLSHModel(inputDim: Int): MinHashLSHModel = { + require(inputDim <= MinHashLSH.HASH_PRIME, + s"The input vector dimension $inputDim exceeds the threshold ${MinHashLSH.HASH_PRIME}.") val rand = new Random($(seed)) - val numEntry = inputDim * 2 - val randCoofs: Array[Int] = Array.fill($(outputDim))(1 + rand.nextInt(MinHash.prime - 1)) - new MinHashModel(uid, numEntry, randCoofs) + val randCoefs: Array[(Int, Int)] = Array.fill(2 * $(numHashTables)) { --- End diff -- Unit tests added in LSHTest.scala
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org