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

    https://github.com/apache/spark/pull/8561#discussion_r39005650
  
    --- Diff: python/pyspark/ml/feature.py ---
    @@ -167,6 +168,137 @@ def getSplits(self):
     
     
     @inherit_doc
    +class CountVectorizer(JavaEstimator, HasInputCol, HasOutputCol):
    +    """
    +    Extracts a vocabulary from document collections and generates a 
[[CountVectorizerModel]].
    +    >>> df = sqlContext.createDataFrame(
    +    ...    [(0, ["a", "b", "c"]), (1, ["a", "b", "b", "c", "a"])],
    +    ...    ["label", "raw"])
    +    >>> cv = CountVectorizer(inputCol="raw", outputCol="vectors")
    +    >>> model = cv.fit(df)
    +    >>> model.transform(df).show(truncate=False)
    +    +-----+---------------+-------------------------+
    +    |label|raw            |vectors                  |
    +    +-----+---------------+-------------------------+
    +    |0    |[a, b, c]      |(3,[0,1,2],[1.0,1.0,1.0])|
    +    |1    |[a, b, b, c, a]|(3,[0,1,2],[2.0,2.0,1.0])|
    +    +-----+---------------+-------------------------+
    +    ...
    --- End diff --
    
    also test `vocabulary`


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