Github user yanboliang commented on a diff in the pull request:
https://github.com/apache/spark/pull/16117#discussion_r90776748
--- Diff: R/pkg/R/mllib.R ---
@@ -817,44 +804,29 @@ setMethod("predict", signature(object =
"LogisticRegressionModel"),
# Get the summary of an LogisticRegressionModel
#' @param object an LogisticRegressionModel fitted by \code{spark.logit}
-#' @return \code{summary} returns the Binary Logistic regression results
of a given model as list,
-#' including roc, areaUnderROC, pr, fMeasureByThreshold,
precisionByThreshold,
-#' recallByThreshold, totalIterations, objectiveHistory. Note that
Multinomial logistic
-#' regression summary is not available now.
+#' @return \code{summary} returns coefficients matrix of the fitted model
#' @rdname spark.logit
#' @aliases summary,LogisticRegressionModel-method
#' @export
#' @note summary(LogisticRegressionModel) since 2.1.0
setMethod("summary", signature(object = "LogisticRegressionModel"),
function(object) {
jobj <- object@jobj
- is.loaded <- callJMethod(jobj, "isLoaded")
-
- if (is.loaded) {
- stop("Loaded model doesn't have training summary.")
+ features <- callJMethod(jobj, "rFeatures")
+ labels <- callJMethod(jobj, "labels")
+ coefficients <- callJMethod(jobj, "rCoefficients")
+ nCol <- length(coefficients) / length(features)
--- End diff --
Yeah, we could. The reason I did this way is we may add more model
statistics which are different for binomial and multinomial logistic regression
later, so we need to distinguish them at R side in any way.
---
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]