Github user MLnick commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12938#discussion_r65778263
  
    --- Diff: python/pyspark/ml/classification.py ---
    @@ -183,7 +191,7 @@ def getThresholds(self):
             If :py:attr:`thresholds` is set, return its value.
             Otherwise, if :py:attr:`threshold` is set, return the equivalent 
thresholds for binary
             classification: (1-threshold, threshold).
    -        If neither are set, throw an error.
    --- End diff --
    
    If neither are explicitly set, it does in fact throw an error:
    
    ```
    In [22]: if not lr.isSet(lr.thresholds) and lr.isSet(lr.threshold):
       ....:     t = lr.getOrDefault(lr.threshold)
       ....:     [1.0-t, t]
       ....: else:
       ....:     lr.getOrDefault(lr.thresholds)
       ....:
    ---------------------------------------------------------------------------
    KeyError                                  Traceback (most recent call last)
    <ipython-input-22-869f82439552> in <module>()
          3     [1.0-t, t]
          4 else:
    ----> 5     lr.getOrDefault(lr.thresholds)
          6
    
    
/Users/nick/workspace/scala/mlnick-spark/python/pyspark/ml/param/__init__.pyc 
in getOrDefault(self, param)
        348             return self._paramMap[param]
        349         else:
    --> 350             return self._defaultParamMap[param]
        351
        352     @since("1.4.0")
    
    KeyError: Param(parent=u'LogisticRegression_4b97b6978cdc41d90ee3', 
name='thresholds', doc="Thresholds in multi-class classification to adjust the 
probability of predicting each class. Array must have length equal to the 
number of classes, with values >= 0. The class with largest value p/t is 
predicted, where p is the original probability of that class and t is the 
class' threshold.")
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to