GitHub user actuaryzhang opened a pull request: https://github.com/apache/spark/pull/16740
[SPARK-19400] Allow GLM to handle intercept only model ## What changes were proposed in this pull request? Intercept-only GLM is failing for non-Gaussian family because of reducing an empty array in IWLS. The following code `val maxTolOfCoefficients = oldCoefficients.toArray.reduce { (x, y) => math.max(math.abs(x), math.abs(y))` fails in the intercept-only model because `oldCoefficients` is empty. This PR fixes this issue. @yanboliang @srowen @imatiach-msft @zhengruifeng ## How was this patch tested? New test for intercept only model. You can merge this pull request into a Git repository by running: $ git pull https://github.com/actuaryzhang/spark interceptOnly Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/16740.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #16740 ---- commit 69d96319abaa7f4aa98c04ce32556a2cb2c065d2 Author: actuaryzhang <actuaryzhan...@gmail.com> Date: 2017-01-30T07:59:11Z fix error in reducing empty array ---- --- 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