spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sethah <>
Subject [GitHub] spark pull request: [SPARK-13047][PYSPARK][ML] Pyspark Params.hasP...
Date Thu, 28 Jan 2016 03:52:11 GMT
Github user sethah commented on a diff in the pull request:
    --- Diff: python/pyspark/ml/param/ ---
    @@ -152,13 +152,17 @@ def isDefined(self, param):
             return self.isSet(param) or self.hasDefault(param)
    -    def hasParam(self, paramName):
    +    def hasParam(self, param):
    -        Tests whether this instance contains a param with a given
    -        (string) name.
    +        Tests whether this instance contains a param.
    -        param = self._resolveParam(paramName)
    -        return param in self.params
    +        if isinstance(param, Param):
    +            return hasattr(self,
    --- End diff --
    I tend to agree that we should only accept string types for this function. The reason
I have included `Param` type is because in the current ml param tests, there is a check where
`hasParam` is called by passing a `Param` instance instead of a string, so this test would
fail ([see here](
It is odd that the test passes a `Param` instance and not a string, since the function describes
itself as accepting strings, but, in an odd twist, the check works anyway.
    If we do accept `Param` type, we can't call `_shouldOwn` because it throws an error instead
of returning `False` (by design?). At any rate, I vote to accept only strings and change the
test to pass in the param name instead of the param. 

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message