You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by dbtsai <gi...@git.apache.org> on 2015/09/21 23:52:25 UTC

[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

GitHub user dbtsai opened a pull request:

    https://github.com/apache/spark/pull/8853

    [SPARK-10738][ML] Refactoring `Instance` out from LOR and LIR, and also cleaning up some code

    Refactoring `Instance` case class out from LOR and LIR, and also cleaning up some code.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dbtsai/spark refactoring

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/8853.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #8853
    
----
commit b98d0967ada4c8743033cb92c7ed7de3d65e4541
Author: DB Tsai <db...@netflix.com>
Date:   2015-09-21T21:25:38Z

    Refacotoring

commit 9410c24952b1da92ba06d5662803f86a87bc6a3c
Author: DB Tsai <db...@netflix.com>
Date:   2015-09-21T21:48:53Z

    refactoring

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-144331242
  
      [Test build #43126 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43126/console) for   PR 8853 at commit [`2ac1d03`](https://github.com/apache/spark/commit/2ac1d03b29be2b1ef309109dbfa0cf2f41f7a509).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by dbtsai <gi...@git.apache.org>.
Github user dbtsai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8853#discussion_r40767101
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/regression/LinearRegressionSuite.scala ---
    @@ -20,6 +20,7 @@ package org.apache.spark.ml.regression
     import scala.util.Random
     
     import org.apache.spark.SparkFunSuite
    +import org.apache.spark.ml.feature.Instance
    --- End diff --
    
    They are used to construct the synthetic weighted data.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-144321093
  
     Merged build triggered.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-142140129
  
      [Test build #42785 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/42785/console) for   PR 8853 at commit [`1d13918`](https://github.com/apache/spark/commit/1d139189d57c88fdc0f78b5af3ebc81997ab2b31).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-142122682
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/42781/
    Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8853#discussion_r40754595
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/regression/LinearRegressionSuite.scala ---
    @@ -20,6 +20,7 @@ package org.apache.spark.ml.regression
     import scala.util.Random
     
     import org.apache.spark.SparkFunSuite
    +import org.apache.spark.ml.feature.Instance
    --- End diff --
    
    not necessary


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-142121937
  
     Merged build triggered.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-142140335
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/42785/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by dbtsai <gi...@git.apache.org>.
Github user dbtsai commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-144266021
  
    Okay. It makes sense. But it's still private, and cleans up some code, do u think it worths to merge it first and we can think about where is the best place to have it?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/8853


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-142121954
  
    Merged build started.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-142140331
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-142122226
  
      [Test build #42781 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/42781/consoleFull) for   PR 8853 at commit [`9410c24`](https://github.com/apache/spark/commit/9410c24952b1da92ba06d5662803f86a87bc6a3c).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by mengxr <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-142131942
  
      [Test build #42785 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/42785/consoleFull) for   PR 8853 at commit [`1d13918`](https://github.com/apache/spark/commit/1d139189d57c88fdc0f78b5af3ebc81997ab2b31).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-142129812
  
    Merged build started.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-144259441
  
    It will be quite hard, e.g., in survival model, we have a column called `censor`. In the future, we might want to add `offset` to instances used in linear models.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by dbtsai <gi...@git.apache.org>.
Github user dbtsai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8853#discussion_r40767420
  
    --- 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 = {
    +    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)
    +            }
               }
    +          lossSum += weight * diff * diff / 2.0
             }
    -        lossSum += weight * diff * diff / 2.0
    -      }
     
    -      totalCnt += 1
    -      weightSum += weight
    -      this
    +        totalCnt += 1
    --- End diff --
    
    The indentation is correct since we added another block. But I'm going to remove this block for your previous comment.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by dbtsai <gi...@git.apache.org>.
Github user dbtsai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8853#discussion_r40767083
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/classification/LogisticRegressionSuite.scala ---
    @@ -20,6 +20,7 @@ package org.apache.spark.ml.classification
     import scala.util.Random
     
     import org.apache.spark.SparkFunSuite
    +import org.apache.spark.ml.feature.Instance
    --- End diff --
    
    They are used to construct the synthetic weighted data.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-144322508
  
      [Test build #43126 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43126/consoleFull) for   PR 8853 at commit [`2ac1d03`](https://github.com/apache/spark/commit/2ac1d03b29be2b1ef309109dbfa0cf2f41f7a509).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8853#discussion_r40754635
  
    --- 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 = {
    +    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)
    +            }
               }
    +          lossSum += weight * diff * diff / 2.0
             }
    -        lossSum += weight * diff * diff / 2.0
    -      }
     
    -      totalCnt += 1
    -      weightSum += weight
    -      this
    +        totalCnt += 1
    --- End diff --
    
    The indentation seems wrong.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-144321113
  
    Merged build started.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8853#discussion_r40754590
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/classification/LogisticRegressionSuite.scala ---
    @@ -20,6 +20,7 @@ package org.apache.spark.ml.classification
     import scala.util.Random
     
     import org.apache.spark.SparkFunSuite
    +import org.apache.spark.ml.feature.Instance
    --- End diff --
    
    not necessary


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-143951133
  
    @dbtsai The main question would be where we should put `Instance`. I'm not sure `ml.feature` is a good place for it, though I don't have good alternatives. Another place is `ml.util`, not ideal either.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-144331374
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43126/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by dbtsai <gi...@git.apache.org>.
Github user dbtsai commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-144101215
  
    I know `ml.feature` is mostly for feature engineering, but I don't think `ml.util` is a good place. How about make it as first citizen in `ml`? I will implement different type of `Instance` for unweighted version. 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-142129790
  
     Merged build triggered.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-146356551
  
    LGTM. Merged into master. Sorry for the delay!


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-142122675
  
      [Test build #42781 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/42781/console) for   PR 8853 at commit [`9410c24`](https://github.com/apache/spark/commit/9410c24952b1da92ba06d5662803f86a87bc6a3c).
     * This patch **fails Scala style tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-144331370
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10738][ML] Refactoring `Instance` out f...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/8853#issuecomment-142122681
  
    Merged build finished. Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org