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

[jira] [Comment Edited] (SPARK-17025) Cannot persist PySpark ML Pipeline model that includes custom Transformer

    [ https://issues.apache.org/jira/browse/SPARK-17025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16855948#comment-16855948 ] 

John Bauer edited comment on SPARK-17025 at 6/4/19 11:10 PM:
-------------------------------------------------------------

[~Hadar] [~yug95] [~ralucamaria.bala@gmail.com] I wrote a minimal example of a PySpark estimator/model pair which can be saved and loaded at [ImputeNormal|https://github.com/JohnHBauer/ImputeNormal] which imputes missing values from a normal distribution using parameters estimated from the data.  Let me know if it helps you,


was (Author: johnhbauer):
[~Hadar] [~yug95] I wrote a minimal example of a PySpark estimator/model pair which can be saved and loaded at [ImputeNormal|https://github.com/JohnHBauer/ImputeNormal] which imputes missing values from a normal distribution using parameters estimated from the data.  Let me know if it helps you,

> Cannot persist PySpark ML Pipeline model that includes custom Transformer
> -------------------------------------------------------------------------
>
>                 Key: SPARK-17025
>                 URL: https://issues.apache.org/jira/browse/SPARK-17025
>             Project: Spark
>          Issue Type: New Feature
>          Components: ML, PySpark
>    Affects Versions: 2.0.0
>            Reporter: Nicholas Chammas
>            Assignee: Ajay Saini
>            Priority: Minor
>             Fix For: 2.3.0
>
>
> Following the example in [this Databricks blog post|https://databricks.com/blog/2016/05/31/apache-spark-2-0-preview-machine-learning-model-persistence.html] under "Python tuning", I'm trying to save an ML Pipeline model.
> This pipeline, however, includes a custom transformer. When I try to save the model, the operation fails because the custom transformer doesn't have a {{_to_java}} attribute.
> {code}
> Traceback (most recent call last):
>   File ".../file.py", line 56, in <module>
>     model.bestModel.save('model')
>   File "/usr/local/Cellar/apache-spark/2.0.0/libexec/python/lib/pyspark.zip/pyspark/ml/pipeline.py", line 222, in save
>   File "/usr/local/Cellar/apache-spark/2.0.0/libexec/python/lib/pyspark.zip/pyspark/ml/pipeline.py", line 217, in write
>   File "/usr/local/Cellar/apache-spark/2.0.0/libexec/python/lib/pyspark.zip/pyspark/ml/util.py", line 93, in __init__
>   File "/usr/local/Cellar/apache-spark/2.0.0/libexec/python/lib/pyspark.zip/pyspark/ml/pipeline.py", line 254, in _to_java
> AttributeError: 'PeoplePairFeaturizer' object has no attribute '_to_java'
> {code}
> Looking at the source code for [ml/base.py|https://github.com/apache/spark/blob/acaf2a81ad5238fd1bc81e7be2c328f40c07e755/python/pyspark/ml/base.py], I see that not even the base Transformer class has such an attribute.
> I'm assuming this is missing functionality that is intended to be patched up (i.e. [like this|https://github.com/apache/spark/blob/acaf2a81ad5238fd1bc81e7be2c328f40c07e755/python/pyspark/ml/classification.py#L1421-L1433]).
> I'm not sure if there is an existing JIRA for this (my searches didn't turn up clear results).



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