title: Serialize a custom transformer using python to be used within a Pyspark ML pipeline
body: <p>I found the same discussion in comments section of <a href="https://stackoverflow.com/questions/32331848/create-a-custom-transformer-in-pyspark-ml">Create a custom Transformer in PySpark ML</a>, but there is no clear answer. There is also an unresolved JIRA corresponding to that: <a href="https://issues.apache.org/jira/browse/SPARK-17025" rel="noreferrer">https://issues.apache.org/jira/browse/SPARK-17025</a>. </p>
  
  <p>Given that there is no option provided by Pyspark ML pipeline for saving a custom transformer written in python, what are the other options to get it done? How can I implement the _to_java method in my python class that returns a compatible java object? </p>