Github user dbtsai commented on a diff in the pull request:
https://github.com/apache/spark/pull/5809#discussion_r29474647
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala ---
@@ -350,7 +345,6 @@ private class LeastSquaresAggregator(
}
}
lossSum += diff * diff / 2.0
- diffSum += diff
--- End diff --
When I started to implement this code, I thought diffSum will not be zero.
@mengxr caught that I don't add the correction terms back to the gradient
correctly, but I still get the right models compared with R that made me go
through the math again, and I found diffSum is always zero theoretically. Here
is the proof added in the comment
https://github.com/apache/spark/commit/15995c883aa248235fdebf0cbeeaa3ef12c97e9c
Array type is obvious since it's Array.ofDim. I did consider to remove the
Long type, but in the end, I worry about someone can mistakenly remove L from
0L, so I decided to keep 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]