yuhao yang created SPARK-20271:
----------------------------------

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


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 and you can 
find some examples in the PR.






--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to