GitHub user sethah opened a pull request:

    https://github.com/apache/spark/pull/13036

    [SPARK-15243][ML][PYSPARK] Param methods should use basestring for type 
checking

    ## What changes were proposed in this pull request?
    
    The following methods used `isinstance(value, str)` for checking string 
types in Python ML params:
    
    * `_resolveParam(param)`
    * `hasParam(param)`
    
    This causes a `ValueError` in Python 2.x when `param` is a unicode string:
    
    ```python
    >>> from pyspark.ml.classification import LogisticRegression
    >>> lr = LogisticRegression()
    >>> lr.hasParam("threshold")
    True
    >>> lr.hasParam(u"threshold")
    Traceback (most recent call last):
     ...
        raise TypeError("hasParam(): paramName must be a string")
    TypeError: hasParam(): paramName must be a string
    >>> 
    ```
    
    
    ## How was this patch tested?
    
    Unit tests added to `python/ml/tests.py`

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/sethah/spark SPARK-15243

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/13036.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #13036
    
----
commit 878fc5fda77ee8824c3f7b66bdde8ea09b6d3274
Author: sethah <[email protected]>
Date:   2016-05-10T22:44:10Z

    check for basestring in param methods

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to