Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-19400

GLM fails for intercept only model

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.2.0
    • ML
    • None

    Description

      Intercept-only GLM fails for non-Gaussian family because of reducing an empty array in IWLS.

      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)
      
      java.lang.UnsupportedOperationException: empty.reduceLeft
      

      Attachments

        Activity

          People

            actuaryzhang Wayne Zhang
            actuaryzhang Wayne Zhang
            Yanbo Liang Yanbo Liang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: