You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by jk...@apache.org on 2015/10/07 21:01:01 UTC

spark git commit: [SPARK-9841] [ML] Make clear public

Repository: spark
Updated Branches:
  refs/heads/master 6ca27f855 -> 5be5d2474


[SPARK-9841] [ML] Make clear public

It is currently impossible to clear Param values once set. It would be helpful to be able to.

Author: Holden Karau <ho...@pigscanfly.ca>

Closes #8619 from holdenk/SPARK-9841-params-clear-needs-to-be-public.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/5be5d247
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/5be5d247
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/5be5d247

Branch: refs/heads/master
Commit: 5be5d247440d6346d667c4b3d817666126f62906
Parents: 6ca27f8
Author: Holden Karau <ho...@pigscanfly.ca>
Authored: Wed Oct 7 12:00:56 2015 -0700
Committer: Joseph K. Bradley <jo...@databricks.com>
Committed: Wed Oct 7 12:00:56 2015 -0700

----------------------------------------------------------------------
 mllib/src/main/scala/org/apache/spark/ml/param/params.scala     | 2 +-
 .../src/test/scala/org/apache/spark/ml/param/ParamsSuite.scala  | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/5be5d247/mllib/src/main/scala/org/apache/spark/ml/param/params.scala
----------------------------------------------------------------------
diff --git a/mllib/src/main/scala/org/apache/spark/ml/param/params.scala b/mllib/src/main/scala/org/apache/spark/ml/param/params.scala
index 48f6269..ec98b05 100644
--- a/mllib/src/main/scala/org/apache/spark/ml/param/params.scala
+++ b/mllib/src/main/scala/org/apache/spark/ml/param/params.scala
@@ -454,7 +454,7 @@ trait Params extends Identifiable with Serializable {
   /**
    * Clears the user-supplied value for the input param.
    */
-  protected final def clear(param: Param[_]): this.type = {
+  final def clear(param: Param[_]): this.type = {
     shouldOwn(param)
     paramMap.remove(param)
     this

http://git-wip-us.apache.org/repos/asf/spark/blob/5be5d247/mllib/src/test/scala/org/apache/spark/ml/param/ParamsSuite.scala
----------------------------------------------------------------------
diff --git a/mllib/src/test/scala/org/apache/spark/ml/param/ParamsSuite.scala b/mllib/src/test/scala/org/apache/spark/ml/param/ParamsSuite.scala
index dfab82c..a2ea279 100644
--- a/mllib/src/test/scala/org/apache/spark/ml/param/ParamsSuite.scala
+++ b/mllib/src/test/scala/org/apache/spark/ml/param/ParamsSuite.scala
@@ -156,6 +156,11 @@ class ParamsSuite extends SparkFunSuite {
     solver.clearMaxIter()
     assert(!solver.isSet(maxIter))
 
+    // Re-set and clear maxIter using the generic clear API
+    solver.setMaxIter(10)
+    solver.clear(maxIter)
+    assert(!solver.isSet(maxIter))
+
     val copied = solver.copy(ParamMap(solver.maxIter -> 50))
     assert(copied.uid === solver.uid)
     assert(copied.getInputCol === solver.getInputCol)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org