BryanCutler commented on a change in pull request #26130: 
[SPARK-29464][PYTHON][ML] PySpark ML should expose Params.clear() to unset a 
user supplied Param
URL: https://github.com/apache/spark/pull/26130#discussion_r336267804
 
 

 ##########
 File path: python/pyspark/ml/tests/test_param.py
 ##########
 @@ -248,6 +252,18 @@ def test_params(self):
                        "maxIter: max number of iterations (>= 0). (default: 
10, current: 100)",
                        "seed: random seed. (default: 41, current: 43)"]))
 
+    def test_clear_param(self):
+        df = self.spark.createDataFrame([(Vectors.dense([1.0]),), 
(Vectors.dense([2.0]),)], ["a"])
+        maScaler = MaxAbsScaler(inputCol="a", outputCol="scaled")
+        model = maScaler.fit(df)
+        self.assertTrue(model.isSet(model.outputCol))
+        self.assertEqual(model.getOutputCol(), "scaled")
+        model.clear(model.outputCol)
+        self.assertFalse(model.isSet(model.outputCol))
+        self.assertEqual(model.getOutputCol()[:12], 'MaxAbsScaler')
 
 Review comment:
   Nvm, I guess there isn't a way to get the default value directly. This is 
fine then.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to