Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/16149#discussion_r91958478
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/regression/GeneralizedLinearRegression.scala
---
@@ -467,10 +469,12 @@ object GeneralizedLinearRegression extends
DefaultParamsReadable[GeneralizedLine
override def variance(mu: Double): Double = mu * (1.0 - mu)
+ private def ylogy(y: Double, mu: Double): Double = {
+ if (y == 0) 0.0 else y * math.log(y / mu)
+ }
+
override def deviance(y: Double, mu: Double, weight: Double): Double =
{
--- End diff --
Yes, but isn't handling y=0 better than introducing a tiny error in
computation? there's no need to avoid computing y ln y at y=0 because it's
value is well defined for this purpose. It seems quite less clear to me; I've
only ever seen computing y ln y by special-casing y=0 and not restricting its
domain.
---
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]