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

    https://github.com/apache/spark/pull/12393#discussion_r59721591
  
    --- Diff: R/pkg/R/mllib.R ---
    @@ -101,12 +101,54 @@ setMethod("summary", signature(object = 
"GeneralizedLinearRegressionModel"),
                 jobj <- object@jobj
                 features <- callJMethod(jobj, "rFeatures")
                 coefficients <- callJMethod(jobj, "rCoefficients")
    -            coefficients <- as.matrix(unlist(coefficients))
    -            colnames(coefficients) <- c("Estimate")
    +            deviance.resid <- callJMethod(jobj, "rDevianceResiduals")
    +            dispersion <- callJMethod(jobj, "rDispersion")
    +            null.deviance <- callJMethod(jobj, "rNullDeviance")
    +            deviance <- callJMethod(jobj, "rDeviance")
    +            df.null <- callJMethod(jobj, "rResidualDegreeOfFreedomNull")
    +            df.residual <- callJMethod(jobj, "rResidualDegreeOfFreedom")
    +            aic <- callJMethod(jobj, "rAic")
    +            iter <- callJMethod(jobj, "rNumIterations")
    +            family <- callJMethod(jobj, "rFamily")
    +
    +            deviance.resid <- dataFrame(deviance.resid)
    +            coefficients <- matrix(coefficients, ncol = 4)
    +            colnames(coefficients) <- c("Estimate", "Std. Error", "t 
value", "Pr(>|t|)")
                 rownames(coefficients) <- unlist(features)
    -            return(list(coefficients = coefficients))
    +            ans <- list(deviance.resid = deviance.resid, coefficients = 
coefficients,
    +                        dispersion = dispersion, null.deviance = 
null.deviance,
    +                        deviance = deviance, df.null = df.null, 
df.residual = df.residual,
    +                        aic = aic, iter = iter, family = family)
    +            class(ans) <- "summary.GeneralizedLinearRegressionModel"
    +            return(ans)
               })
     
    +#' Print the summary of GeneralizedLinearRegressionModel
    +#'
    +#' @rdname print
    +#' @name print.summary.GeneralizedLinearRegressionModel
    +#' @export
    +print.summary.GeneralizedLinearRegressionModel <- function(x, ...) {
    --- End diff --
    
    Add this S3 function for formatted output of 
summary(GeneralizedLinearRegressionModel).


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to