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

    https://github.com/apache/spark/pull/5767#discussion_r29325700
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala ---
    @@ -110,59 +110,70 @@ class LinearRegression extends Regressor[Vector, 
LinearRegression, LinearRegress
         val yMean = statCounter.mean
         val yStd = math.sqrt(statCounter.variance)
     
    -    val featuresMean = summarizer.mean.toArray
    -    val featuresStd = summarizer.variance.toArray.map(math.sqrt)
    -
    -    // Since we implicitly do the feature scaling when we compute the cost 
function
    -    // to improve the convergence, the effective regParam will be changed.
    -    val effectiveRegParam = paramMap(regParam) / yStd
    -    val effectiveL1RegParam = paramMap(elasticNetParam) * effectiveRegParam
    -    val effectiveL2RegParam = (1.0 - paramMap(elasticNetParam)) * 
effectiveRegParam
    -
    -    val costFun = new LeastSquaresCostFun(instances, yStd, yMean,
    -      featuresStd, featuresMean, effectiveL2RegParam)
    -
    -    val optimizer = if (paramMap(elasticNetParam) == 0.0 || 
effectiveRegParam == 0.0) {
    -      new BreezeLBFGS[BDV[Double]](paramMap(maxIter), 10, paramMap(tol))
    -    } else {
    -      new BreezeOWLQN[Int, BDV[Double]](paramMap(maxIter), 10, 
effectiveL1RegParam, paramMap(tol))
    -    }
    +    // If the yStd is zero, then the intercept is yStd with zero weights.
    --- End diff --
    
    ...the intercept is yMean...


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