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

    https://github.com/apache/spark/pull/10940#discussion_r51054476
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
 ---
    @@ -341,11 +341,11 @@ class LogisticRegression @Since("1.2.0") (
                     regParamL1
                   } else {
                     // If `standardization` is false, we still standardize the 
data
    -                // to improve the rate of convergence; as a result, we 
have to
    -                // perform this reverse standardization by penalizing each 
component
    -                // differently to get effectively the same objective 
function when
    +                // to improve the rate of convergence unless the standard 
deviation is zero;
    +                // as a result, we have to perform this reverse 
standardization by penalizing
    +                // each component differently to get effectively the same 
objective function when
                     // the training dataset is not standardized.
    -                if (featuresStd(index) != 0.0) regParamL1 / 
featuresStd(index) else 0.0
    +                if (featuresStd(index) != 0.0) regParamL1 / 
featuresStd(index) else regParamL1
    --- End diff --
    
    @coderxiang You may try it out. When `value` is very small like `1e-6` as a 
constant comparing the rest of the features, the corresponding coefficient will 
be very large. In this case, the optimization on coefficients will be on 
different scales, and this often causes some convergence issue in line search. 
    
    Similar argument can be made when the constant `value` is very large 
comparing the rest of the features. 
    
    That's why we still standardize the features even users ask 
`standardization == false`.


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

Reply via email to