GitHub user actuaryzhang opened a pull request:

    https://github.com/apache/spark/pull/17879

    [SPARK-20619][ML]StringIndexer supports multiple ways of label ordering

    ## What changes were proposed in this pull request?
    
    StringIndexer maps labels to numbers according to the descending order of 
label frequency. Other types of ordering (e.g., alphabetical) may be needed in 
feature ETL, for example, this will affect the result in one-hot encoding. The 
PR proposes to support other ordering method including alphabetic order and 
ascending order of label frequency. We add a parameter `stringOrderType` to 
control how string is ordered which supports four options:
    - 'freq_desc': descending order by label frequency (most frequent label 
assigned 0)
    - 'freq_asc': ascending order by label frequency (least frequent label 
assigned 0)
    - 'alphabet_desc': descending alphabetical order
    - 'alphabet_asc': ascending alphabetical order
    
    The default is still descending order of label frequency, so there should 
be no impact to existing programs.
    
    ## How was this patch tested?
    new test 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/actuaryzhang/spark stringIndexer

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/17879.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #17879
    
----
commit ffd0cfc755586402c0f22e4458149eed16f98010
Author: Wayne Zhang <[email protected]>
Date:   2017-05-06T06:54:41Z

    StringIndexer supports multiple ways of label ordering

----


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