diff options
Diffstat (limited to 'mllib/src')
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/ml/param/params.scala | 2 | ||||
-rw-r--r-- | mllib/src/test/scala/org/apache/spark/ml/param/ParamsSuite.scala | 5 |
2 files changed, 6 insertions, 1 deletions
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 48f6269e57..ec98b05e13 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 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 dfab82c8b6..a2ea279f5d 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) |