Github user sethah commented on a diff in the pull request:
https://github.com/apache/spark/pull/16131#discussion_r90882138
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/regression/GeneralizedLinearRegression.scala
---
@@ -505,7 +505,7 @@ object GeneralizedLinearRegression extends
DefaultParamsReadable[GeneralizedLine
override def initialize(y: Double, weight: Double): Double = {
require(y >= 0.0, "The response variable of Poisson family " +
s"should be non-negative, but got $y")
- y
+ y + 0.1
--- End diff --
The problem I see is that the initial learned model always produces `mu ~=
0`, which causes the adjusted response to blow up (since it depends on `1/mu`).
That causes the predicted response to blow up, which finally causes the weights
to become infinity.
BTW, statsmodels in Python initializes all families except Binomial to
`mu_0 = (y + avg(y)) / 2`. I am curious if we have a reference for defaulting
to `mu_0 = y` when we first implemented GLR. It would be nice to have a sound
reason for the initialization other than matching one package or the other,
though probably not strictly necessary.
---
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]