You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by yanboliang <gi...@git.apache.org> on 2016/12/02 08:21:46 UTC

[GitHub] spark pull request #16117: [SPARK-18686][SparkR][ML] Several cleanup and imp...

GitHub user yanboliang opened a pull request:

    https://github.com/apache/spark/pull/16117

    [SPARK-18686][SparkR][ML] Several cleanup and improvements for spark.logit.

    ## What changes were proposed in this pull request?
    Several cleanup and improvements for ```spark.logit```:
    * ```summary``` should return coefficients matrix, and should output labels for each class if the model is multinomial logistic regression model.
    * ```summary``` should not return ```areaUnderROC, roc, pr, ...```, since most of them are DataFrame which are less important for R users. Meanwhile, these metrics ignore instance weights (setting all to 1.0) which will be changed in later Spark version. In case it will introduce breaking changes, we do not expose them currently.
    * SparkR test improvement: comparing the training result with native R glmnet.
    * Remove argument ```aggregationDepth``` from ```spark.logit```, since it's an expert Param(related with Spark architecture and job execution) that would be used rarely by R users.
    
    ## How was this patch tested?
    Unit tests.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/yanboliang/spark spark-18686

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/16117.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #16117
    
----
commit e78adcd4a5685bbf292a864e77dc1b345854e047
Author: Yanbo Liang <yb...@gmail.com>
Date:   2016-12-02T08:16:18Z

    Several cleanup and improvements for spark.logit.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/69556/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    **[Test build #69638 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69638/consoleFull)** for PR 16117 at commit [`6fc9dec`](https://github.com/apache/spark/commit/6fc9decc27ab4b6d2d78be914835f30491a2a07b).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/69638/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    **[Test build #69556 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69556/consoleFull)** for PR 16117 at commit [`e78adcd`](https://github.com/apache/spark/commit/e78adcd4a5685bbf292a864e77dc1b345854e047).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    **[Test build #69718 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69718/consoleFull)** for PR 16117 at commit [`914c9ac`](https://github.com/apache/spark/commit/914c9ac26ea9e5beec89e1eec0dd0de0d1babaaf).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #16117: [SPARK-18686][SparkR][ML] Several cleanup and imp...

Posted by wangmiao1981 <gi...@git.apache.org>.
Github user wangmiao1981 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16117#discussion_r90693837
  
    --- Diff: R/pkg/R/mllib.R ---
    @@ -733,8 +733,6 @@ setMethod("predict", signature(object = "KMeansModel"),
     #'                  excepting that at most one value may be 0. The class with largest value p/t is predicted, where p
     #'                  is the original probability of that class and t is the class's threshold.
     #' @param weightCol The weight column name.
    -#' @param aggregationDepth depth for treeAggregate (>= 2). If the dimensions of features or the number of partitions
    -#'                         are large, this param could be adjusted to a larger size.
    --- End diff --
    
    `aggregationDepth` is still on scala side. Any reason to remove it?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    **[Test build #69718 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69718/consoleFull)** for PR 16117 at commit [`914c9ac`](https://github.com/apache/spark/commit/914c9ac26ea9e5beec89e1eec0dd0de0d1babaaf).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #16117: [SPARK-18686][SparkR][ML] Several cleanup and imp...

Posted by yanboliang <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    **[Test build #69638 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69638/consoleFull)** for PR 16117 at commit [`6fc9dec`](https://github.com/apache/spark/commit/6fc9decc27ab4b6d2d78be914835f30491a2a07b).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    cc @wangmiao1981 @felixcheung @jkbradley 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #16117: [SPARK-18686][SparkR][ML] Several cleanup and imp...

Posted by wangmiao1981 <gi...@git.apache.org>.
Github user wangmiao1981 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16117#discussion_r90694148
  
    --- Diff: R/pkg/R/mllib.R ---
    @@ -746,45 +744,35 @@ setMethod("predict", signature(object = "KMeansModel"),
     #' \dontrun{
     #' sparkR.session()
     #' # binary logistic regression
    -#' label <- c(0.0, 0.0, 0.0, 1.0, 1.0)
    -#' features <- c(1.1419053, 0.9194079, -0.9498666, -1.1069903, 0.2809776)
    -#' binary_data <- as.data.frame(cbind(label, features))
    -#' binary_df <- createDataFrame(binary_data)
    -#' blr_model <- spark.logit(binary_df, label ~ features, thresholds = 1.0)
    -#' blr_predict <- collect(select(predict(blr_model, binary_df), "prediction"))
    -#'
    -#' # summary of binary logistic regression
    -#' blr_summary <- summary(blr_model)
    -#' blr_fmeasure <- collect(select(blr_summary$fMeasureByThreshold, "threshold", "F-Measure"))
    +#' df <- suppressWarnings(createDataFrame(iris))
    +#' training <- df[df$Species %in% c("versicolor", "virginica"), ]
    +#' model <- spark.logit(training, Species ~ ., regParam = 0.5)
    +#' summary <- summary(model)
    +#'
    +#' # fitted values on training data
    +#' fitted <- predict(model, training)
    +#'
     #' # save fitted model to input path
     #' path <- "path/to/model"
     #' write.ml(blr_model, path)
    --- End diff --
    
    Since you changed `blr_model` -> `model`, it should be `model` here.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #16117: [SPARK-18686][SparkR][ML] Several cleanup and imp...

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16117#discussion_r90783819
  
    --- Diff: R/pkg/R/mllib.R ---
    @@ -746,45 +744,35 @@ setMethod("predict", signature(object = "KMeansModel"),
     #' \dontrun{
     #' sparkR.session()
     #' # binary logistic regression
    -#' label <- c(0.0, 0.0, 0.0, 1.0, 1.0)
    -#' features <- c(1.1419053, 0.9194079, -0.9498666, -1.1069903, 0.2809776)
    -#' binary_data <- as.data.frame(cbind(label, features))
    -#' binary_df <- createDataFrame(binary_data)
    -#' blr_model <- spark.logit(binary_df, label ~ features, thresholds = 1.0)
    -#' blr_predict <- collect(select(predict(blr_model, binary_df), "prediction"))
    -#'
    -#' # summary of binary logistic regression
    -#' blr_summary <- summary(blr_model)
    -#' blr_fmeasure <- collect(select(blr_summary$fMeasureByThreshold, "threshold", "F-Measure"))
    +#' df <- suppressWarnings(createDataFrame(iris))
    --- End diff --
    
    we tried not to have suppressWarnings in example - while a warning message is not great (we have a JIRA on columns with `_`...) IMO it's best not to have it in example which probably raises more questions for a causal reader.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #16117: [SPARK-18686][SparkR][ML] Several cleanup and imp...

Posted by wangmiao1981 <gi...@git.apache.org>.
Github user wangmiao1981 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16117#discussion_r90808362
  
    --- 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 --
    
    Sounds good.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #16117: [SPARK-18686][SparkR][ML] Several cleanup and imp...

Posted by wangmiao1981 <gi...@git.apache.org>.
Github user wangmiao1981 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16117#discussion_r90692812
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/r/LogisticRegressionWrapper.scala ---
    @@ -164,9 +174,10 @@ private[r] object LogisticRegressionWrapper
           val rMetadataStr = sc.textFile(rMetadataPath, 1).first()
           val rMetadata = parse(rMetadataStr)
           val features = (rMetadata \ "features").extract[Array[String]]
    +      val labels = (rMetadata \ "labels").extract[Array[String]]
     
           val pipeline = PipelineModel.load(pipelinePath)
    -      new LogisticRegressionWrapper(pipeline, features, isLoaded = true)
    +      new LogisticRegressionWrapper(pipeline, features, labels)
         }
       }
     }
    --- End diff --
    
    new line?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #16117: [SPARK-18686][SparkR][ML] Several cleanup and imp...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16117#discussion_r90776572
  
    --- Diff: R/pkg/R/mllib.R ---
    @@ -746,45 +744,35 @@ setMethod("predict", signature(object = "KMeansModel"),
     #' \dontrun{
     #' sparkR.session()
     #' # binary logistic regression
    -#' label <- c(0.0, 0.0, 0.0, 1.0, 1.0)
    -#' features <- c(1.1419053, 0.9194079, -0.9498666, -1.1069903, 0.2809776)
    -#' binary_data <- as.data.frame(cbind(label, features))
    -#' binary_df <- createDataFrame(binary_data)
    -#' blr_model <- spark.logit(binary_df, label ~ features, thresholds = 1.0)
    -#' blr_predict <- collect(select(predict(blr_model, binary_df), "prediction"))
    -#'
    -#' # summary of binary logistic regression
    -#' blr_summary <- summary(blr_model)
    -#' blr_fmeasure <- collect(select(blr_summary$fMeasureByThreshold, "threshold", "F-Measure"))
    +#' df <- suppressWarnings(createDataFrame(iris))
    +#' training <- df[df$Species %in% c("versicolor", "virginica"), ]
    +#' model <- spark.logit(training, Species ~ ., regParam = 0.5)
    +#' summary <- summary(model)
    +#'
    +#' # fitted values on training data
    +#' fitted <- predict(model, training)
    +#'
     #' # save fitted model to input path
     #' path <- "path/to/model"
     #' write.ml(blr_model, path)
    --- End diff --
    
    Good catch, updated. Thanks.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #16117: [SPARK-18686][SparkR][ML] Several cleanup and imp...

Posted by wangmiao1981 <gi...@git.apache.org>.
Github user wangmiao1981 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16117#discussion_r90694765
  
    --- 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 --
    
    Can we do the `nCol` calculation and column name on scala side? So, we don't have to call `rFeatures` and `labels` on R side, which makes the logic simpler. 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    Since this will involve breaking change if we merge it after 2.1 release, and actually I think it belongs to the scope of QA, so I'll merge it into master and branch-2.1, thanks for all your reviewing.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/69718/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #16117: [SPARK-18686][SparkR][ML] Several cleanup and imp...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/16117


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    LGTM except a minor comment on example. thanks!


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #16117: [SPARK-18686][SparkR][ML] Several cleanup and improvemen...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/16117
  
    **[Test build #69556 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69556/consoleFull)** for PR 16117 at commit [`e78adcd`](https://github.com/apache/spark/commit/e78adcd4a5685bbf292a864e77dc1b345854e047).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org