Github user yanboliang commented on a diff in the pull request:
https://github.com/apache/spark/pull/16344#discussion_r95995765
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/regression/GeneralizedLinearRegression.scala
---
@@ -613,25 +758,67 @@ object GeneralizedLinearRegression extends
DefaultParamsReadable[GeneralizedLine
private[regression] object Link {
/**
- * Gets the [[Link]] object from its name.
+ * Gets the [[Link]] object based on link and linkPower.
+ * 1) if family is "tweedie", retrieve object using linkPower
+ * 2) otherwise, retrieve object based on link name
*
- * @param name link name: "identity", "logit", "log",
- * "inverse", "probit", "cloglog" or "sqrt".
+ * @param params the parameter map containing link and link power
*/
- def fromName(name: String): Link = {
- name match {
- case Identity.name => Identity
- case Logit.name => Logit
- case Log.name => Log
- case Inverse.name => Inverse
- case Probit.name => Probit
- case CLogLog.name => CLogLog
- case Sqrt.name => Sqrt
+ def fromParams(params: GeneralizedLinearRegressionBase): Link = {
+ if (params.getFamily == "tweedie") {
+ params.getLinkPower match {
+ case 0.0 => Log
+ case 1.0 => Identity
+ case -1.0 => Inverse
+ case 0.5 => Sqrt
+ case others => new PowerLink(others)
+ }
--- End diff --
There is no default value for ```linkPower```, what happened if users don't
set it?
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]