I come across this when I read the code from apache-spark:
val alpha = new DoubleParam(this, "alpha", "alpha for implicit preference", ParamValidators.gtEq(0)) /** @group getParam */ def getAlpha: Double = $(alpha)
I searched the Internet for a long time, but still can't find a good explanation of what $(alpha) means here? How to assign a DoubleParam class DoubleParam with a self- DoubleParam Double value? Thanks!!
FYI, the DoubleParam class DoubleParam defined as:
class DoubleParam(parent: String, name: String, doc: String, isValid: Double => Boolean) extends Param[Double](parent, name, doc, isValid) { def this(parent: String, name: String, doc: String) = this(parent, name, doc, ParamValidators.alwaysTrue) def this(parent: Identifiable, name: String, doc: String, isValid: Double => Boolean) = this(parent.uid, name, doc, isValid) def this(parent: Identifiable, name: String, doc: String) = this(parent.uid, name, doc) /** Creates a param pair with the given value (for Java). */ override def w(value: Double): ParamPair[Double] = super.w(value) }
source share