You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Bryan Cutler (JIRA)" <ji...@apache.org> on 2016/04/30 00:08:12 UTC

[jira] [Commented] (SPARK-15018) PySpark ML Pipeline fails when no stages set

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

Bryan Cutler commented on SPARK-15018:
--------------------------------------

I have a fix for this

> PySpark ML Pipeline fails when no stages set
> --------------------------------------------
>
>                 Key: SPARK-15018
>                 URL: https://issues.apache.org/jira/browse/SPARK-15018
>             Project: Spark
>          Issue Type: Bug
>          Components: ML, PySpark
>            Reporter: Bryan Cutler
>
> When fitting a PySpark Pipeline with no stages, it should work as an identity transformer.  Instead the following error is raised:
> {noformat}
> Traceback (most recent call last):
>   File "./spark/python/pyspark/ml/base.py", line 64, in fit
>     return self._fit(dataset)
>   File "./spark/python/pyspark/ml/pipeline.py", line 99, in _fit
>     for stage in stages:
> TypeError: 'NoneType' object is not iterable
> {noformat}
> The param {{stages}} should be added to the default param list and {{getStages}} should call {{getOrDefault}}.
> Also, since the default value is {{None}} is then changed to and empty list {{[]}}, this never changes the value if passed in as a keyword argument.  Instead, the {{kwargs}} value should be changed directly if {{stages is None}}.
> For example
> {noformat}
> if stages is None:
>     stages = []
> {noformat}
> should be this
> {noformat}
> if stages is None:
>     kwargs['stages'] = []
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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