wbo4958 commented on code in PR #49596:
URL: https://github.com/apache/spark/pull/49596#discussion_r1926309453


##########
python/pyspark/ml/tests/test_pipeline.py:
##########
@@ -58,6 +70,109 @@ def doTransform(pipeline):
         # check that failure to set stages param will raise KeyError for 
missing param
         self.assertRaises(KeyError, lambda: doTransform(Pipeline()))
 
+    def test_classification_pipeline(self):
+        df = self.spark.createDataFrame([(1, 1, 0, 3), (0, 2, 0, 1)], ["y", 
"a", "b", "c"])
+
+        assembler = VectorAssembler(outputCol="features")
+        assembler.setInputCols(["a", "b", "c"])
+
+        scaler = MaxAbsScaler(inputCol="features", outputCol="scaled_features")
+
+        lr = LogisticRegression(featuresCol="scaled_features", labelCol="y")
+        lr.setMaxIter(1)
+
+        pipeline = Pipeline(stages=[assembler, scaler, lr])
+        self.assertEqual(len(pipeline.getStages()), 3)
+
+        # Pipeline save & load
+        with tempfile.TemporaryDirectory(prefix="classification_pipeline") as 
d:
+            pipeline.write().overwrite().save(d)

Review Comment:
   I made a PR (https://github.com/apache/spark/pull/49610 ) to combine the 
read/write for estimator and model in the same directory, which could avoid 
re-creating the directory twice, and the "overwrite" could be exactly tested.  



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to