Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12498#discussion_r60242000
  
    --- 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 --
    
    Yes, it's better to save it as a function whenever the setter is called 
then to update the param.In this PR I just follow the exist ML style. I think 
all ML params setter need this behavior change and it's better to discuss more, 
so may be do it in a separate PR?


---
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]

Reply via email to