GitHub user sryza opened a pull request:
https://github.com/apache/spark/pull/5500
SPARK-5888. [MLLIB]. Add OneHotEncoder as a Transformer
This patch adds a one hot encoder for categorical features. Planning to
add documentation and another test after getting feedback on the approach.
A couple choices made here:
* There's an `includeFirst` option which, if false, creates numCategories -
1 columns and, if true, creates numCategories columns. The default is true,
which is the behavior in scikit-learn.
* The user is expected to pass a `Seq` of category names when instantiating
a `OneHotEncoder`. These can be easily gotten from a `StringIndexer`. The
names are used for the output column names, which take the form
colName_categoryName.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/sryza/spark sandy-spark-5888
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/5500.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 #5500
----
commit 04590bc362d011cc92b7ca1e703c15e090805b71
Author: Sandy Ryza <[email protected]>
Date: 2015-04-13T23:40:04Z
SPARK-5888. [MLLIB]. Add OneHotEncoder as a Transformer
----
---
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]