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


##########
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:
   since `overwrite` is not supported for now, we will need to create sub 
dictionary



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