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

    https://github.com/apache/spark/pull/8853#discussion_r40754661
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala ---
    @@ -541,36 +536,38 @@ private class LeastSquaresAggregator(
       private val gradientSumArray = Array.ofDim[Double](dim)
     
       /**
    -   * Add a new training data to this LeastSquaresAggregator, and update 
the loss and gradient
    +   * Add a new training instance to this LeastSquaresAggregator, and 
update the loss and gradient
        * of the objective function.
        *
    -   * @param instance  The data point instance to be added.
    +   * @param instance The instance of data point to be added.
        * @return This LeastSquaresAggregator object.
        */
    -  def add(instance: Instance): this.type =
    -    instance match { case Instance(label, weight, features) =>
    -      require(dim == features.size, s"Dimensions mismatch when adding new 
sample." +
    -        s" Expecting $dim but got ${features.size}.")
    -      require(weight >= 0.0, s"instance weight, ${weight} has to be >= 
0.0")
    -
    -      if (weight == 0.0) return this
    -
    -      val diff = dot(features, effectiveCoefficientsVector) - label / 
labelStd + offset
    -
    -      if (diff != 0) {
    -        val localGradientSumArray = gradientSumArray
    -        features.foreachActive { (index, value) =>
    -          if (featuresStd(index) != 0.0 && value != 0.0) {
    -            localGradientSumArray(index) += weight * diff * value / 
featuresStd(index)
    +  def add(instance: Instance): this.type = {
    --- End diff --
    
    I think we shouldn't change this block. We can keep `case Instance(..` in 
this 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 [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