Github user yanboliang commented on a diff in the pull request: https://github.com/apache/spark/pull/16344#discussion_r95989723 --- Diff: mllib/src/main/scala/org/apache/spark/ml/regression/GeneralizedLinearRegression.scala --- @@ -57,30 +57,72 @@ private[regression] trait GeneralizedLinearRegressionBase extends PredictorParam final val family: Param[String] = new Param(this, "family", "The name of family which is a description of the error distribution to be used in the " + s"model. Supported options: ${supportedFamilyNames.mkString(", ")}.", - ParamValidators.inArray[String](supportedFamilyNames.toArray)) + ParamValidators.inArray[String](supportedFamilyNames)) /** @group getParam */ @Since("2.0.0") def getFamily: String = $(family) /** + * Param for the power in the variance function of the Tweedie distribution which provides + * the relationship between the variance and mean of the distribution. + * Used only for the Tweedie family. + * (see <a href="https://en.wikipedia.org/wiki/Tweedie_distribution"> + * Tweedie Distribution (Wikipedia)</a>) + * Supported values: 0 and [1, Inf). + * Note that variance power 0, 1, or 2 corresponds to the Gaussian, Poisson or Gamma + * family, respectively. + * + * @group param + */ + @Since("2.2.0") + final val variancePower: Param[Double] = new Param(this, "variancePower", + "The power in the variance function of the Tweedie distribution which characterizes " + + "the relationship between the variance and mean of the distribution. " + + "Used only for the Tweedie family. Supported values: 0 and [1, Inf).", + (x: Double) => x >= 1.0 || x == 0.0) + + /** @group getParam */ + @Since("2.2.0") + def getVariancePower: Double = $(variancePower) + + /** * Param for the name of link function which provides the relationship * between the linear predictor and the mean of the distribution function. * Supported options: "identity", "log", "inverse", "logit", "probit", "cloglog" and "sqrt". + * This is used only when family is not "tweedie". The link function for the "tweedie" family + * must be specified through [[linkPower]]. * * @group param */ @Since("2.0.0") final val link: Param[String] = new Param(this, "link", "The name of link function " + "which provides the relationship between the linear predictor and the mean of the " + s"distribution function. Supported options: ${supportedLinkNames.mkString(", ")}", - ParamValidators.inArray[String](supportedLinkNames.toArray)) + ParamValidators.inArray[String](supportedLinkNames)) /** @group getParam */ @Since("2.0.0") def getLink: String = $(link) /** + * Param for the index in the power link function. This is used to specify the link function + * in the Tweedie family. + * Note that link power 0, 1, -1 or 0.5 corresponds to the Log, Identity, Inverse or Sqrt + * link, respectively. + * + * @group param + */ + @Since("2.2.0") + final val linkPower: Param[Double] = new Param(this, "linkPower", + "The index in the power link function. This is used to specify the link function in the " + + "Tweedie family.", (x: Double) => true) --- End diff -- Remove ```(x: Double) => true``` since there is no validation check for this param.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org