Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private[shared] object SharedParamsCodeGen {
ParamDesc[String]("solver", "the solver algorithm for optimization. If this is not set or " +
"empty, default value is 'auto'", Some("\"auto\"")),
ParamDesc[Int]("aggregationDepth", "suggested depth for treeAggregate (>= 2)", Some("2"),
isValid = "ParamValidators.gtEq(2)"))
isValid = "ParamValidators.gtEq(2)", isExpertParam = true))

val code = genSharedParams(params)
val file = "src/main/scala/org/apache/spark/ml/param/shared/sharedParams.scala"
Expand All @@ -95,7 +95,8 @@ private[shared] object SharedParamsCodeGen {
doc: String,
defaultValueStr: Option[String] = None,
isValid: String = "",
finalMethods: Boolean = true) {
finalMethods: Boolean = true,
isExpertParam: Boolean = false) {

require(name.matches("[a-z][a-zA-Z0-9]*"), s"Param name $name is invalid.")
require(doc.nonEmpty) // TODO: more rigorous on doc
Expand Down Expand Up @@ -153,6 +154,11 @@ private[shared] object SharedParamsCodeGen {
} else {
""
}
val groupStr = if (param.isExpertParam) {
Array("expertParam", "expertGetParam")
} else {
Array("param", "getParam")
}
val methodStr = if (param.finalMethods) {
"final def"
} else {
Expand All @@ -167,11 +173,11 @@ private[shared] object SharedParamsCodeGen {
|
| /**
| * Param for $doc.
| * @group param
| * @group ${groupStr(0)}
| */
| final val $name: $Param = new $Param(this, "$name", "$doc"$isValid)
|$setDefault
| /** @group getParam */
| /** @group ${groupStr(1)} */
| $methodStr get$Name: $T = $$($name)
|}
|""".stripMargin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,13 @@ private[ml] trait HasAggregationDepth extends Params {

/**
* Param for suggested depth for treeAggregate (>= 2).
* @group param
* @group expertParam
*/
final val aggregationDepth: IntParam = new IntParam(this, "aggregationDepth", "suggested depth for treeAggregate (>= 2)", ParamValidators.gtEq(2))

setDefault(aggregationDepth, 2)

/** @group getParam */
/** @group expertGetParam */
final def getAggregationDepth: Int = $(aggregationDepth)
}
// scalastyle:on