[SPARK-7498] [ML] removed varargs annotation from Params.setDefaults
In SPARK-7429 and PR https://github.com/apache/spark/pull/5960, I added the varargs annotation to Params.setDefault which takes a variable number of ParamPairs. It worked locally and on Jenkins for me.
However, mengxr reported issues compiling on his machine. So I'm reverting the change introduced in https://github.com/apache/spark/pull/5960 by removing varargs.
Author: Joseph K. Bradley <joseph@databricks.com>
Closes #6021 from jkbradley/revert-varargs and squashes the following commits:
098ed39 [Joseph K. Bradley] removed varargs annotation from Params.setDefaults taking multiple ParamPairs
(cherry picked from commit 2992623841
)
Signed-off-by: Xiangrui Meng <meng@databricks.com>
This commit is contained in:
parent
80bbe72d55
commit
25972d3713
|
@ -387,11 +387,12 @@ trait Params extends Identifiable with Serializable {
|
|||
/**
|
||||
* Sets default values for a list of params.
|
||||
*
|
||||
* Note: Java developers should use the single-parameter [[setDefault()]].
|
||||
* Annotating this with varargs causes compilation failures. See SPARK-7498.
|
||||
* @param paramPairs a list of param pairs that specify params and their default values to set
|
||||
* respectively. Make sure that the params are initialized before this method
|
||||
* gets called.
|
||||
*/
|
||||
@varargs
|
||||
protected final def setDefault(paramPairs: ParamPair[_]*): this.type = {
|
||||
paramPairs.foreach { p =>
|
||||
setDefault(p.param.asInstanceOf[Param[Any]], p.value)
|
||||
|
|
|
@ -59,6 +59,5 @@ public class JavaTestParams extends JavaParams {
|
|||
ParamValidators.inArray(validStrings));
|
||||
setDefault(myIntParam, 1);
|
||||
setDefault(myDoubleParam, 0.5);
|
||||
setDefault(myIntParam.w(1), myDoubleParam.w(0.5));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue