Skip to content
Snippets Groups Projects
Commit 5be5d247 authored by Holden Karau's avatar Holden Karau Committed by Joseph K. Bradley
Browse files

[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 <holden@pigscanfly.ca>

Closes #8619 from holdenk/SPARK-9841-params-clear-needs-to-be-public.
parent 6ca27f85
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment