Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-7429] [ml] Params cleanups #5960

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions mllib/src/main/scala/org/apache/spark/ml/param/params.scala
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,11 @@ 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.
*
* @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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class CrossValidator extends Estimator[CrossValidatorModel] with CrossValidatorP

override def fit(dataset: DataFrame): CrossValidatorModel = {
val schema = dataset.schema
transformSchema(dataset.schema, logging = true)
transformSchema(schema, logging = true)
val sqlCtx = dataset.sqlContext
val est = $(estimator)
val eval = $(evaluator)
Expand Down Expand Up @@ -159,6 +159,7 @@ class CrossValidatorModel private[ml] (
}

override def transform(dataset: DataFrame): DataFrame = {
transformSchema(dataset.schema, logging = true)
bestModel.transform(dataset)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ public JavaTestParams() {
ParamValidators.inArray(validStrings));
setDefault(myIntParam, 1);
setDefault(myDoubleParam, 0.5);
setDefault(myIntParam.w(1), myDoubleParam.w(0.5));
}
}