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

    https://github.com/apache/spark/pull/18128#discussion_r119978607
  
    --- Diff: R/pkg/R/mllib_classification.R ---
    @@ -239,21 +253,64 @@ function(object, path, overwrite = FALSE) {
     setMethod("spark.logit", signature(data = "SparkDataFrame", formula = 
"formula"),
               function(data, formula, regParam = 0.0, elasticNetParam = 0.0, 
maxIter = 100,
                        tol = 1E-6, family = "auto", standardization = TRUE,
    -                   thresholds = 0.5, weightCol = NULL, aggregationDepth = 
2) {
    +                   thresholds = 0.5, weightCol = NULL, aggregationDepth = 
2,
    +                   lowerBoundsOnCoefficients = NULL, 
upperBoundsOnCoefficients = NULL,
    +                   lowerBoundsOnIntercepts = NULL, upperBoundsOnIntercepts 
= NULL) {
                 formula <- paste(deparse(formula), collapse = "")
    +            row <- 0
    +            col <- 0
     
                 if (!is.null(weightCol) && weightCol == "") {
                   weightCol <- NULL
                 } else if (!is.null(weightCol)) {
                   weightCol <- as.character(weightCol)
                 }
     
    +            if (!is.null(lowerBoundsOnIntercepts)) {
    +                lowerBoundsOnIntercepts <- 
as.array(lowerBoundsOnIntercepts)
    +            }
    +
    +            if (!is.null(upperBoundsOnIntercepts)) {
    +                upperBoundsOnIntercepts <- 
as.array(upperBoundsOnIntercepts)
    +            }
    +
    +            if (!is.null(lowerBoundsOnCoefficients)) {
    +              if (class(lowerBoundsOnCoefficients) != "matrix") {
    +                stop("lowerBoundsOnCoefficients must be a matrix.")
    +              }
    +              row <- nrow(lowerBoundsOnCoefficients)
    +              col <- ncol(lowerBoundsOnCoefficients)
    +              lowerBoundsOnCoefficients <- 
as.array(as.vector(lowerBoundsOnCoefficients))
    +            }
    +
    +            if (!is.null(upperBoundsOnCoefficients)) {
    +              if (class(upperBoundsOnCoefficients) != "matrix") {
    +                stop("upperBoundsOnCoefficients must be a matrix.")
    +              }
    +
    +              if (!is.null(lowerBoundsOnCoefficients) & (row != 
nrow(upperBoundsOnCoefficients)
    +                | col != ncol(upperBoundsOnCoefficients))) {
    +                stop(paste("dimension of upperBoundsOnCoefficients ",
    +                           "is not the same as lowerBoundsOnCoefficients", 
sep = ""))
    +              }
    +
    +              if (is.null(lowerBoundsOnCoefficients)) {
    +                row <- nrow(upperBoundsOnCoefficients)
    +                col <- ncol(upperBoundsOnCoefficients)
    +              }
    +
    +              upperBoundsOnCoefficients <- 
as.array(as.vector(upperBoundsOnCoefficients))
    +            }
    +
                 jobj <- 
callJStatic("org.apache.spark.ml.r.LogisticRegressionWrapper", "fit",
                                     data@sdf, formula, as.numeric(regParam),
                                     as.numeric(elasticNetParam), 
as.integer(maxIter),
                                     as.numeric(tol), as.character(family),
                                     as.logical(standardization), 
as.array(thresholds),
    -                                weightCol, as.integer(aggregationDepth))
    +                                weightCol, as.integer(aggregationDepth),
    +                                as.integer(row), as.integer(col),
    --- End diff --
    
    nit: no need to `as.integer(row)` and `as.integer(col)` since they are set 
internally and not a parameter


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