Github user dbtsai commented on a diff in the pull request: https://github.com/apache/spark/pull/17715#discussion_r113065566 --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala --- @@ -434,8 +587,45 @@ class LogisticRegression @Since("1.2.0") ( $(standardization), bcFeaturesStd, regParamL2, multinomial = isMultinomial, $(aggregationDepth)) + val numCoeffs = numFeaturesPlusIntercept * numCoefficientSets + val isSetLowerBoundOfCoefficients = isSet(lowerBoundOfCoefficients) + val isSetUpperBoundOfCoefficients = isSet(upperBoundOfCoefficients) + val isSetLowerBoundOfIntercept = isSet(lowerBoundOfIntercept) + val isSetUpperBoundOfIntercept = isSet(upperBoundOfIntercept) + var lowerBound: Array[Double] = null + var upperBound: Array[Double] = null + --- End diff -- How about ```scala val (lowerBounds, upperBounds): (Array[Double], Array[Double]) = { if(!usingBoundConstrainedOptimization) return (null, null) val lowerBound = Array.fill[Double](numCoeffs)(Double.NegativeInfinity) val upperBound = Array.fill[Double](numCoeffs)(Double.PositiveInfinity) ... // Have the scaling code here // Also you can have move those variables, isSetLowerBoundOfCoefficients = isSet(lowerBoundOfCoefficients) // val isSetUpperBoundOfCoefficients = isSet(upperBoundOfCoefficients) // val isSetLowerBoundOfIntercept = isSet(lowerBoundOfIntercept) // val isSetUpperBoundOfIntercept // into this block. (lowerBound, upperBound) } ```
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org