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 2022/02/17 15:50:00 UTC
[jira] [Updated] (SPARK-38243) Unintended exception thrown in pyspark.ml.LogisticRegression.getThreshold
[ 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 ~/Workspace/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.format{}}}, 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 ~/Workspace/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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org