You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by actuaryzhang <gi...@git.apache.org> on 2017/01/30 08:16:20 UTC

[GitHub] spark issue #16740: [SPARK-19400] Allow GLM to handle intercept only model

Github user actuaryzhang commented on the issue:

    https://github.com/apache/spark/pull/16740
  
    The following is a simple example to illustrate the issue. 
    
    ```
    val dataset = Seq(
              (1.0, 1.0, 2.0, 0.0, 5.0),
              (0.5, 2.0, 1.0, 1.0, 2.0),
              (1.0, 3.0, 0.5, 2.0, 1.0),
              (2.0, 4.0, 1.5, 3.0, 3.0)
            ).toDF("y", "w", "off", "x1", "x2")
    
    val formula = new RFormula().setFormula("y ~ 1")
    val output = formula.fit(dataset).transform(dataset)
    val glr = new GeneralizedLinearRegression().setFamily("poisson")
    val model = glr.fit(output)
    ```
    
    The above prints out the following error message:
    ```
    java.lang.UnsupportedOperationException: empty.reduceLeft
      at scala.collection.TraversableOnce$class.reduceLeft(TraversableOnce.scala:180)
      at scala.collection.mutable.ArrayOps$ofDouble.scala$collection$IndexedSeqOptimized$$super$reduceLeft(ArrayOps.scala:270)
      at scala.collection.IndexedSeqOptimized$class.reduceLeft(IndexedSeqOptimized.scala:74)
    ```


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org