You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Hyukjin Kwon (JIRA)" <ji...@apache.org> on 2019/05/21 04:01:10 UTC

[jira] [Updated] (SPARK-20271) Add FuncTransformer to simplify custom transformer creation

     [ https://issues.apache.org/jira/browse/SPARK-20271?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hyukjin Kwon updated SPARK-20271:
---------------------------------
    Labels: bulk-closed  (was: )

> Add FuncTransformer to simplify custom transformer creation
> -----------------------------------------------------------
>
>                 Key: SPARK-20271
>                 URL: https://issues.apache.org/jira/browse/SPARK-20271
>             Project: Spark
>          Issue Type: New Feature
>          Components: ML
>    Affects Versions: 2.2.0
>            Reporter: yuhao yang
>            Priority: Major
>              Labels: bulk-closed
>
> Just to share some code I implemented to help easily create a custom Transformer in one line of code w.
> {code} val labelConverter = new FuncTransformer((i: Double) => if (i >= 1) 1 else 0) {code}
> This was used in many of my projects and is pretty helpful (Maybe I'm lazy..). The transformer can be saved/loaded as other transformer and can be integrated into a pipeline normally.  It can be used widely in many use cases like conditional conversion(if...else...), , type conversion, to/from Array, to/from Vector and many string ops..



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org