You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean R. Owen (Jira)" <ji...@apache.org> on 2020/01/15 14:43:00 UTC

[jira] [Resolved] (SPARK-30504) OneVsRest and OneVsRestModel _from_java and _to_java should handle weightCol

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

Sean R. Owen resolved SPARK-30504.
----------------------------------
    Fix Version/s: 3.0.0
       Resolution: Fixed

Issue resolved by pull request 27190
[https://github.com/apache/spark/pull/27190]

> OneVsRest and OneVsRestModel _from_java and _to_java should handle weightCol
> ----------------------------------------------------------------------------
>
>                 Key: SPARK-30504
>                 URL: https://issues.apache.org/jira/browse/SPARK-30504
>             Project: Spark
>          Issue Type: Bug
>          Components: ML, PySpark
>    Affects Versions: 3.0.0
>            Reporter: Maciej Szymkiewicz
>            Assignee: Maciej Szymkiewicz
>            Priority: Major
>             Fix For: 3.0.0
>
>
> Current behaviour
> {code:python}
> from pyspark.ml.classification import LogisticRegression, OneVsRest, OneVsRestModel
> from pyspark.ml.linalg import DenseVector
> df = spark.createDataFrame([(0, 1, DenseVector([1.0, 0.0])), (0, 1, DenseVector([1.0, 0.0]))], ("label", "w", "features"))
> ovr = OneVsRest(classifier=LogisticRegression()).setWeightCol("w")
> ovrm = ovr.fit(df)
> ovr.getWeightCol()
> ## 'w'
> ovrm.getWeightCol()
> ## 'w'
> ovr.write().overwrite().save("/tmp/ovr")
> ovr_ = OneVsRest.load("/tmp/ovr")
> ovr_.getWeightCol()
> ## KeyError   
> ## ...
> ## KeyError: Param(parent='OneVsRest_5145d56b6bd1', name='weightCol', doc='weight column name. ...)
> ovrm.write().overwrite().save("/tmp/ovrm")
> ovrm_ = OneVsRestModel.load("/tmp/ovrm")
> ovrm_ .getWeightCol()
> ## KeyError   
> ## ...
> ## KeyError: Param(parent='OneVsRestModel_598c6d900fad', name='weightCol', doc='weight column name ...
> {code}
> Expected behaviour:
> {{OneVsRest}} and {{OneVsRestModel}} loaded from disk should have {{weightCol}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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