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

    https://github.com/apache/spark/pull/11832#discussion_r56896101
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/feature/HashingTF.scala ---
    @@ -53,9 +65,10 @@ class HashingTF(val numFeatures: Int) extends 
Serializable {
       @Since("1.1.0")
       def transform(document: Iterable[_]): Vector = {
         val termFrequencies = mutable.HashMap.empty[Int, Double]
    +    val setTF = if (binary) (i: Int) => 1.0 else (i: Int) => 
termFrequencies.getOrElse(i, 0.0) + 1.0
    --- End diff --
    
    Are you guys talking about the `document.foreach` loop?  The if-then-else 
is just to assign a function, so it would just be called once per document, 
then the function is called in the loop.  If this line is a bit too much, I 
could rewrite it to something more straightforward.


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