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

    https://github.com/apache/spark/pull/12020#discussion_r58596628
  
    --- Diff: python/pyspark/ml/tuning.py ---
    @@ -91,7 +94,90 @@ def build(self):
             return [dict(zip(keys, prod)) for prod in 
itertools.product(*grid_values)]
     
     
    -class CrossValidator(Estimator, HasSeed):
    +class ValidatorParams(Params):
    +    """
    +    Common params for TrainValidationSplit and CrossValidator.
    +    """
    +
    +    estimator = Param(Params._dummy(), "estimator", "estimator to be 
cross-validated")
    +    estimatorParamMaps = Param(Params._dummy(), "estimatorParamMaps", 
"estimator param maps")
    +    evaluator = Param(
    +        Params._dummy(), "evaluator",
    +        "evaluator used to select hyper-parameters that maximize the 
validator metric")
    +
    +    def __init__(self):
    +        super(ValidatorParams, self).__init__()
    +
    +    def setEstimator(self, value):
    +        """
    +        Sets the value of :py:attr:`estimator`.
    +        """
    +        self._paramMap[self.estimator] = value
    +        return self
    +
    +    def getEstimator(self):
    +        """
    +        Gets the value of estimator or its default value.
    +        """
    +        return self.getOrDefault(self.estimator)
    +
    +    def setEstimatorParamMaps(self, value):
    +        """
    +        Sets the value of :py:attr:`estimatorParamMaps`.
    +        """
    +        self._paramMap[self.estimatorParamMaps] = value
    +        return self
    +
    +    def getEstimatorParamMaps(self):
    +        """
    +        Gets the value of estimatorParamMaps or its default value.
    +        """
    +        return self.getOrDefault(self.estimatorParamMaps)
    +
    +    def setEvaluator(self, value):
    +        """
    +        Sets the value of :py:attr:`evaluator`.
    +        """
    +        self._paramMap[self.evaluator] = value
    +        return self
    +
    +    def getEvaluator(self):
    +        """
    +        Gets the value of evaluator or its default value.
    +        """
    +        return self.getOrDefault(self.evaluator)
    +
    +    @classmethod
    +    def _from_java(cls, java_stage):
    +        """
    +        Return Python estimator, estimatorParamMaps, and evaluator from a 
Java ValidatorParams.
    +        """
    +
    +        # Load information from java_stage to the instance.
    +        estimator = JavaWrapper._from_java(java_stage.getEstimator())
    +        evaluator = JavaWrapper._from_java(java_stage.getEvaluator())
    +        epms = [estimator._transfer_extra_params_from_java(epm)
    +                for epm in java_stage.getEstimatorParamMaps()]
    +        return estimator, epms, evaluator
    +
    +    def _to_java(self):
    --- End diff --
    
    Rename to _to_java_impl since this is a helper.


---
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