Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/12498#discussion_r60237569
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/feature/HashingTF.scala ---
@@ -54,20 +60,43 @@ class HashingTF(val numFeatures: Int) extends
Serializable {
}
/**
+ * Set the hash algorithm used when mapping term to integer.
+ * (default: murmur3)
+ */
+ @Since("2.0.0")
+ def setHashAlgorithm(value: String): this.type = {
+ hashAlgorithm = value
+ this
+ }
+
+ /**
* Returns the index of the input term.
*/
@Since("1.1.0")
+ @deprecated("Use indexOfTerm instead. This method will be removed in
2.1.0.", "2.0.0")
def indexOf(term: Any): Int = Utils.nonNegativeMod(term.##, numFeatures)
/**
+ * Returns the index of the input term by different hash algorithms.
+ */
+ @Since("2.0.0")
+ def indexOfTerm(hashAlgorithm: String)(term: Any): Int = {
--- End diff --
Why would the user pass the hash algorithm again here? you can store a
reference to a function from Any to Int when the hash algorithm is configured,
and not even have to look it up every time.
---
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]