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

Maciej Szymkiewicz updated SPARK-38243:
---------------------------------------
    Description: 
If {{LogisticRegression.getThreshold}} is called with model having multiple 
thresholds we suppose to raise an exception,
{code:python}
ValueError: Logistic Regression getThreshold only applies to binary 
classification ...
{code}
However, {{thresholds}} ({{{}List[float]{}}}) are incorrectly passed to 
{{{}str.join{}}}, resulting in unintended {{TypeError}}


{code:python}
>>> from pyspark.ml.classification import LogisticRegression
... 
... model = LogisticRegression(thresholds=[1.0, 2.0, 3.0])
>>> model.getThreshold()
Traceback (most recent call last):
  Input In [7] in <module>
    model.getThreshold()
  File /path/to/spark/python/pyspark/ml/classification.py:1003 in getThreshold
    + ",".join(ts)
Type Error: sequence item 0: expected str instance, float found

{code}

  was:
If {{LogisticRegression.getThreshold}} is called with model having multiple 
thresholds we suppose to raise an exception,
{code:python}
ValueError: Logistic Regression getThreshold only applies to binary 
classification ...
{code}
However, {{thresholds}} ({{{}List[float]{}}}) are incorrectly passed to 
{{{}str.join{}}}, resulting in unintended {{TypeError}}


{code:python}
>>> from pyspark.ml.classification import LogisticRegression
... 
... model = LogisticRegression(thresholds=[1.0, 2.0, 3.0])
>>> model.getThreshold()
Traceback (most recent call last):
  Input In [7] in <module>
    model.getThreshold()
  File ~/Workspace/spark/python/pyspark/ml/classification.py:1003 in 
getThreshold
    + ",".join(ts)
Type Error: sequence item 0: expected str instance, float found

{code}


> Unintended exception thrown in pyspark.ml.LogisticRegression.getThreshold
> -------------------------------------------------------------------------
>
>                 Key: SPARK-38243
>                 URL: https://issues.apache.org/jira/browse/SPARK-38243
>             Project: Spark
>          Issue Type: Bug
>          Components: ML, PySpark
>    Affects Versions: 2.4.0, 3.1.0, 3.2.0, 3.3.0
>            Reporter: Maciej Szymkiewicz
>            Priority: Minor
>
> If {{LogisticRegression.getThreshold}} is called with model having multiple 
> thresholds we suppose to raise an exception,
> {code:python}
> ValueError: Logistic Regression getThreshold only applies to binary 
> classification ...
> {code}
> However, {{thresholds}} ({{{}List[float]{}}}) are incorrectly passed to 
> {{{}str.join{}}}, resulting in unintended {{TypeError}}
> {code:python}
> >>> from pyspark.ml.classification import LogisticRegression
> ... 
> ... model = LogisticRegression(thresholds=[1.0, 2.0, 3.0])
> >>> model.getThreshold()
> Traceback (most recent call last):
>   Input In [7] in <module>
>     model.getThreshold()
>   File /path/to/spark/python/pyspark/ml/classification.py:1003 in getThreshold
>     + ",".join(ts)
> Type Error: sequence item 0: expected str instance, float found
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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

Reply via email to