Пример #1
0
    def _from_java_impl(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_param_map_from_java(epm)
                for epm in java_stage.getEstimatorParamMaps()]
        return estimator, epms, evaluator
Пример #2
0
    def _from_java_impl(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_param_map_from_java(epm)
            for epm in java_stage.getEstimatorParamMaps()
        ]
        return estimator, epms, evaluator
Пример #3
0
 def _from_java(cls, java_stage):
     """
     Given a Java PipelineModel, create and return a Python wrapper of it.
     Used for ML persistence.
     """
     # Load information from java_stage to the instance.
     py_stages = [JavaWrapper._from_java(s) for s in java_stage.stages()]
     # Create a new instance of this stage.
     py_stage = cls(py_stages)
     py_stage._resetUid(java_stage.uid())
     return py_stage
Пример #4
0
 def _from_java(cls, java_stage):
     """
     Given a Java PipelineModel, create and return a Python wrapper of it.
     Used for ML persistence.
     """
     # Load information from java_stage to the instance.
     py_stages = [JavaWrapper._from_java(s) for s in java_stage.stages()]
     # Create a new instance of this stage.
     py_stage = cls(py_stages)
     py_stage._resetUid(java_stage.uid())
     return py_stage
Пример #5
0
    def _from_java(cls, java_stage):
        """
        Given a Java CrossValidatorModel, create and return a Python wrapper of it.
        Used for ML persistence.
        """

        # Load information from java_stage to the instance.
        bestModel = JavaWrapper._from_java(java_stage.bestModel())
        estimator, epms, evaluator = super(CrossValidatorModel, cls)._from_java_impl(java_stage)
        # Create a new instance of this stage.
        py_stage = cls(bestModel=bestModel)\
            .setEstimator(estimator).setEstimatorParamMaps(epms).setEvaluator(evaluator)
        py_stage._resetUid(java_stage.uid())
        return py_stage
Пример #6
0
    def _from_java(cls, java_stage):
        """
        Given a Java TrainValidationSplitModel, create and return a Python wrapper of it.
        Used for ML persistence.
        """

        # Load information from java_stage to the instance.
        bestModel = JavaWrapper._from_java(java_stage.bestModel())
        estimator, epms, evaluator = \
            super(TrainValidationSplitModel, cls)._from_java_impl(java_stage)
        # Create a new instance of this stage.
        py_stage = cls(bestModel=bestModel)\
            .setEstimator(estimator).setEstimatorParamMaps(epms).setEvaluator(evaluator)
        py_stage._resetUid(java_stage.uid())
        return py_stage