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

    https://github.com/apache/spark/pull/18888#discussion_r132595823
  
    --- Diff: python/pyspark/ml/tests.py ---
    @@ -1142,6 +1142,35 @@ def test_nested_pipeline_persistence(self):
                 except OSError:
                     pass
     
    +    def test_python_transformer_pipeline_persistence(self):
    +        """
    +        Pipeline[MockUnaryTransformer, Binarizer]
    +        """
    +        temp_path = tempfile.mkdtemp()
    +
    +        try:
    +            df = self.spark.range(0, 10).toDF('input')
    +            tf = MockUnaryTransformer(shiftVal=2)\
    +                .setInputCol("input").setOutputCol("shiftedInput")
    +            tf2 = Binarizer(threshold=6, inputCol="shiftedInput", 
outputCol="binarized")
    +            pl = Pipeline(stages=[tf, tf2])
    +            model = pl.fit(df)
    +
    +            pipeline_path = temp_path + "/pipeline"
    +            pl.save(pipeline_path)
    +            loaded_pipeline = Pipeline.load(pipeline_path)
    +            self._compare_pipelines(pl, loaded_pipeline)
    +
    +            model_path = temp_path + "/pipeline-model"
    +            model.save(model_path)
    +            loaded_model = PipelineModel.load(model_path)
    +            self._compare_pipelines(model, loaded_model)
    +        finally:
    +            try:
    +                rmtree(temp_path)
    --- End diff --
    
    This is the same pattern that exists in all other tests so I just followed 
it for this one.


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