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

    https://github.com/apache/spark/pull/16630#discussion_r102564507
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/r/GeneralizedLinearRegressionWrapper.scala
 ---
    @@ -99,37 +95,23 @@ private[r] object GeneralizedLinearRegressionWrapper
         val summary = glm.summary
     
         val rFeatures: Array[String] = if (glm.getFitIntercept) {
    -      Array("(Intercept)") ++ features
    +      Array("(Intercept)") ++ summary.featureNames
         } else {
    -      features
    +      summary.featureNames
         }
     
         val rCoefficients: Array[Double] = if (summary.isNormalSolver) {
    -      val rCoefficientStandardErrors = if (glm.getFitIntercept) {
    -        Array(summary.coefficientStandardErrors.last) ++
    -          summary.coefficientStandardErrors.dropRight(1)
    -      } else {
    -        summary.coefficientStandardErrors
    -      }
    +      val rCoefficientStandardErrors =
    +        summary.summaryTable.select("StdError").collect.map(_.getDouble(0))
     
    -      val rTValues = if (glm.getFitIntercept) {
    -        Array(summary.tValues.last) ++ summary.tValues.dropRight(1)
    -      } else {
    -        summary.tValues
    -      }
    +      val rTValues =
    +        summary.summaryTable.select("TValue").collect.map(_.getDouble(0))
     
    -      val rPValues = if (glm.getFitIntercept) {
    -        Array(summary.pValues.last) ++ summary.pValues.dropRight(1)
    -      } else {
    -        summary.pValues
    -      }
    +      val rPValues =
    +        summary.summaryTable.select("PValue").collect.map(_.getDouble(0))
     
    -      if (glm.getFitIntercept) {
    -        Array(glm.intercept) ++ glm.coefficients.toArray ++
    -          rCoefficientStandardErrors ++ rTValues ++ rPValues
    -      } else {
    -        glm.coefficients.toArray ++ rCoefficientStandardErrors ++ rTValues 
++ rPValues
    -      }
    +      
summary.summaryTable.select("Coefficient").collect.map(_.getDouble(0)) ++
    +        rCoefficientStandardErrors ++ rTValues ++ rPValues
    --- End diff --
    
    Could you run a quick check to see if the values in the SparkR summary are 
the same before and after this change?


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