Github user sethah commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16740#discussion_r99408646
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/regression/GeneralizedLinearRegressionSuite.scala
 ---
    @@ -743,6 +744,50 @@ class GeneralizedLinearRegressionSuite
         }
       }
     
    +  test("generalized linear regression: intercept only") {
    +    /*
    +      R code:
    +      y <- c(17, 19, 23, 29)
    +      w <- c(1, 2, 3, 4)
    +      model1 <- glm(y ~ 1, family = poisson)
    +      model2 <- glm(y ~ 1, family = poisson, weights = w)
    +      as.vector(c(coef(model1), coef(model2)))
    +      [1] 3.091042 3.178054
    +     */
    +
    +    val dataset = Seq(
    +      Instance(17.0, 1.0, Vectors.zeros(0)),
    +      Instance(19.0, 2.0, Vectors.zeros(0)),
    +      Instance(23.0, 3.0, Vectors.zeros(0)),
    +      Instance(29.0, 4.0, Vectors.zeros(0))
    +    ).toDF()
    +
    +    val expected = Seq(3.091, 3.178)
    +
    +    import GeneralizedLinearRegression._
    +
    +    var idx = 0
    +    for (useWeight <- Seq(false, true)) {
    +      val trainer = new GeneralizedLinearRegression().setFamily("poisson")
    --- End diff --
    
    I'm still in favor of checking other families. We had been discussion using 
a formula which ended up working with some families but not others - testing 
all the families would have caught this. 


---
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

Reply via email to