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

    https://github.com/apache/spark/pull/2494#discussion_r17920668
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/mllib/feature/IDFSuite.scala ---
    @@ -54,4 +54,38 @@ class IDFSuite extends FunSuite with LocalSparkContext {
         assert(tfidf2.indices === Array(1))
         assert(tfidf2.values(0) ~== (1.0 * expected(1)) absTol 1e-12)
       }
    +
    +  test("idf minimum occurence filtering") {
    +    val n = 4
    +    val localTermFrequencies = Seq(
    +      Vectors.sparse(n, Array(1, 3), Array(1.0, 2.0)),
    +      Vectors.dense(0.0, 1.0, 2.0, 3.0),
    +      Vectors.sparse(n, Array(1), Array(1.0))
    +    )
    +    val m = localTermFrequencies.size
    +    val termFrequencies = sc.parallelize(localTermFrequencies, 2)
    +    val idf = new IDF(minimumOccurence=1L)
    +    val model = idf.fit(termFrequencies)
    +    val expected = Vectors.dense(Array(0, 3, 1, 2).map { x =>
    +      if(x > 0) {
    +        math.log((m.toDouble + 1.0) / (x + 1.0))
    --- End diff --
    
    Could you remove `.toDouble` from both with your next update? It is 
orthogonal to this PR but it is a small change. Thanks!


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