GitHub user VinceShieh opened a pull request:

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

    [SPARK-17219][ML] enchanced NaN value handling in Bucketizer

    ## What changes were proposed in this pull request?
    
    This PR is an enhancement of PR with commit 
ID:57dc326bd00cf0a49da971e9c573c48ae28acaa2.
    NaN is a special type of value which is commonly seen as invalid. But We 
find that there are certain cases where NaN are also valuable, thus need 
special handling. We provided user when dealing NaN values with 3 options, to 
either reserve an extra bucket for NaN values, or remove the NaN values, or 
report an error, by passing "keep", "skip", or "error"(default) to 
setHandleInvalid.
    
    '''Before:
    val bucketizer: Bucketizer = new Bucketizer()
              .setInputCol("feature")
              .setOutputCol("result")
              .setSplits(splits)
    '''After:
    val bucketizer: Bucketizer = new Bucketizer()
              .setInputCol("feature")
              .setOutputCol("result")
              .setSplits(splits)
              .setHandleInvalid("keep")
    
    ## How was this patch tested?
    Tests added in QuantileDiscretizerSuite and BucketizerSuite
    
    Signed-off-by: VinceShieh <vincent....@intel.com>

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

    $ git pull https://github.com/VinceShieh/spark spark-17219_followup

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

    https://github.com/apache/spark/pull/15428.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 #15428
    
----
commit a3e43086dcf6ecee20461567e2cc506db29f80a7
Author: VinceShieh <vincent....@intel.com>
Date:   2016-10-10T02:33:09Z

    [SPARK-17219][ML] enchance NaN value handling in Bucketizer
    
    This PR is an enhancement of PR with commit 
ID:57dc326bd00cf0a49da971e9c573c48ae28acaa2.
    We provided user when dealing NaN value in the dataset with 3 options, to 
either reserve an extra
    bucket for NaN values, or remove the NaN values, or report an error, by 
passing "keep", "skip",
    or "error"(default) to setHandleInvalid.
    
    '''Before:
    val bucketizer: Bucketizer = new Bucketizer()
              .setInputCol("feature")
              .setOutputCol("result")
              .setSplits(splits)
    '''After:
    val bucketizer: Bucketizer = new Bucketizer()
              .setInputCol("feature")
              .setOutputCol("result")
              .setSplits(splits)
              .setHandleInvalid("skip")
    
    Signed-off-by: VinceShieh <vincent....@intel.com>

----


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