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

    https://github.com/apache/spark/pull/12393#discussion_r59721222
  
    --- 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, ...) {
    +  x$deviance.resid <- setNames(unlist(approxQuantile(x$deviance.resid, 
"devianceResiduals",
    +    c(0.0, 0.25, 0.5, 0.75, 1.0), 0.0)), c("Min", "1Q", "Median", "3Q", 
"Max"))
    --- End diff --
    
    Here we set ```relativeError``` of ```approxQuantile``` to 0.0 which may be 
very expensive for computing. Should we change to more loose value and document 
the difference between SparkR and R?


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