You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Maciej Szymkiewicz (Jira)" <ji...@apache.org> on 2020/01/13 12:36:00 UTC

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

Maciej Szymkiewicz created SPARK-30504:
------------------------------------------

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


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