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

    https://github.com/apache/spark/pull/17978#discussion_r116652102
  
    --- Diff: python/pyspark/ml/feature.py ---
    @@ -2111,26 +2112,45 @@ class StringIndexer(JavaEstimator, HasInputCol, 
HasOutputCol, HasHandleInvalid,
         >>> loadedInverter = IndexToString.load(indexToStringPath)
         >>> loadedInverter.getLabels() == inverter.getLabels()
         True
    +    >>> stringIndexer.getStringOrderType()
    +    'frequencyDesc'
    +    >>> stringIndexer = StringIndexer(inputCol="label", 
outputCol="indexed", handleInvalid='error',
    +    ...     stringOrderType="alphabetDesc")
    +    >>> model = stringIndexer.fit(stringIndDf)
    +    >>> td = model.transform(stringIndDf)
    +    >>> sorted(set([(i[0], i[1]) for i in td.select(td.id, 
td.indexed).collect()]),
    +    ...     key=lambda x: x[0])
    +    [(0, 2.0), (1, 1.0), (2, 0.0), (3, 2.0), (4, 2.0), (5, 0.0)]
     
         .. versionadded:: 1.4.0
         """
     
    +    stringOrderType = Param(Params._dummy(), "stringOrderType",
    +                            "How to order labels of string column. The 
first label after " +
    +                            "ordering is assigned an index of 0. Supported 
options: " +
    +                            "frequencyDesc, frequencyAsc, alphabetDesc, 
alphabetAsc.",
    --- End diff --
    
    I think this should be generated instead of hardcoded - you can find a 
example on python..


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