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

    https://github.com/apache/spark/pull/12200#discussion_r58754307
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/feature/CountVectorizerSuite.scala ---
    @@ -183,6 +183,26 @@ class CountVectorizerSuite extends SparkFunSuite with 
MLlibTestSparkContext
           case Row(features: Vector, expected: Vector) =>
             assert(features ~== expected absTol 1e-14)
         }
    +
    +    // CountVectorizer test
    +    val df2 = sqlContext.createDataFrame(Seq(
    +      (0, split("a b c d e a b"),
    +        Vectors.sparse(5, Seq((0, 1.0), (1, 1.0), (2, 1.0), (3, 1.0), (4, 
1.0)))),
    +      (1, split("a a a a a a"), Vectors.sparse(5, Seq((0, 1.0)))),
    +      (2, split("c c"), Vectors.sparse(5, Seq((2, 1.0)))),
    +      (3, split("b b b b b"), Vectors.sparse(5, Seq((1, 1.0)))))
    +    ).toDF("id", "words", "expected")
    +    val cv2 = new CountVectorizer()
    +      .setInputCol("words")
    +      .setOutputCol("features")
    +      .setBinary(true)
    +      .fit(df2)
    +    assert(cv2.vocabulary === Array("a", "b", "c", "d", "e"))
    --- End diff --
    
    I put there to catch the possible vocabulary index change. I will remove 
it. 
    Thanks!
    Miao


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

Reply via email to