You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by WeichenXu123 <gi...@git.apache.org> on 2017/08/09 17:19:28 UTC

[GitHub] spark pull request #18896: [SPARK-21681][ML] fix bug of MLOR do not work cor...

GitHub user WeichenXu123 opened a pull request:

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

    [SPARK-21681][ML] fix bug of MLOR do not work correctly when featureStd contains zero	

    ## What changes were proposed in this pull request?
    
    fix bug of MLOR do not work correctly when featureStd contains zero	
    
    ## How was this patch tested?
    
    N/A

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

    $ git pull https://github.com/WeichenXu123/spark fix_mlor_stdvalue_zero_bug

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

    https://github.com/apache/spark/pull/18896.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 #18896
    
----
commit c415ddeb1182f8243e5330d294665079c21a8a19
Author: WeichenXu <we...@outlook.com>
Date:   2017-08-09T17:17:43Z

    init pr

----


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    **[Test build #80462 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80462/testReport)** for PR 18896 at commit [`c415dde`](https://github.com/apache/spark/commit/c415ddeb1182f8243e5330d294665079c21a8a19).
     * 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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by MLnick <gi...@git.apache.org>.
Github user MLnick commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    Fix seems ok - but just wondering why the test for zero std dev in `LogisticAggregatorSuite` didn't pick this up? cc @sethah 
    
    https://github.com/apache/spark/blob/cf29828d720611f7633a8114917bac901f76dece/mllib/src/test/scala/org/apache/spark/ml/optim/aggregator/LogisticAggregatorSuite.scala#L232 


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    @jkbradley OK. (Can this directly merged to 2.2 ?)


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by sethah <gi...@git.apache.org>.
Github user sethah commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    Thanks for catching this @WeichenXu123! I just added a note about the intent of test.


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    **[Test build #80680 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80680/testReport)** for PR 18896 at commit [`9339145`](https://github.com/apache/spark/commit/9339145f79b7eddd9455b64c63c9133ce35acd26).


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/80462/
    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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    @MLnick That's because, this bug will be triggered only when we standardize feature first then do training...


---
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 #18896: [SPARK-21681][ML] fix bug of MLOR do not work cor...

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

    https://github.com/apache/spark/pull/18896#discussion_r134076580
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/classification/LogisticRegressionSuite.scala ---
    @@ -1392,6 +1415,61 @@ class LogisticRegressionSuite
         assert(model2.interceptVector.toArray.sum ~== 0.0 absTol eps)
       }
     
    +  test("multinomial logistic regression with zero variance (SPARK-21681)") {
    +    val sqlContext = multinomialDatasetWithZeroVar.sqlContext
    +    import sqlContext.implicits._
    +    val mlr = new LogisticRegression().setFamily("multinomial").setFitIntercept(true)
    +      .setElasticNetParam(0.0).setRegParam(0.0).setStandardization(true).setWeightCol("weight")
    +
    +    val model = mlr.fit(multinomialDatasetWithZeroVar)
    +
    +    /*
    +     Use the following R code to load the data and train the model using glmnet package.
    +
    +     library("glmnet")
    +     data <- read.csv("path", header=FALSE)
    +     label = as.factor(data$V1)
    +     w = data$V2
    +     features = as.matrix(data.frame(data$V3, data$V4))
    +     coefficients = coef(glmnet(features, label, weights=w, family="multinomial",
    +     alpha = 0, lambda = 0))
    +     coefficients
    +     $`0`
    +     3 x 1 sparse Matrix of class "dgCMatrix"
    +                    s0
    +             0.2658824
    +     data.V3 0.1881871
    +     data.V4 .
    +
    +     $`1`
    +     3 x 1 sparse Matrix of class "dgCMatrix"
    +                      s0
    +              0.53604701
    +     data.V3 -0.02412645
    +     data.V4  .
    +
    +     $`2`
    +     3 x 1 sparse Matrix of class "dgCMatrix"
    +                     s0
    +             -0.8019294
    +     data.V3 -0.1640607
    +     data.V4  .
    +    */
    +
    +    val coefficientsR = new DenseMatrix(3, 2, Array(
    +      0.1881871, -0.0,
    --- End diff --
    
    Why `-0.0`?


---
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 #18896: [SPARK-21681][ML] fix bug of MLOR do not work cor...

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

    https://github.com/apache/spark/pull/18896#discussion_r133301688
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/classification/LogisticRegressionSuite.scala ---
    @@ -1392,6 +1415,61 @@ class LogisticRegressionSuite
         assert(model2.interceptVector.toArray.sum ~== 0.0 absTol eps)
       }
     
    +  test("test SPARK-21681") {
    --- End diff --
    
    I would include a description of the test in addition to the ticket #.


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/80708/
    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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    @MLnick Yes it is always trained in scaled space. But the testcase you mentioned do not take the "scale" step, so do not trigger the bug...


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by MLnick <gi...@git.apache.org>.
Github user MLnick commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    cc @sethah 


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    **[Test build #80927 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80927/testReport)** for PR 18896 at commit [`1f4ba14`](https://github.com/apache/spark/commit/1f4ba14bf41f1cf05749bfc0951cd4844b00b861).


---
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 #18896: [SPARK-21681][ML] fix bug of MLOR do not work cor...

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

    https://github.com/apache/spark/pull/18896#discussion_r134076552
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/optim/aggregator/LogisticAggregatorSuite.scala ---
    @@ -238,8 +238,17 @@ class LogisticAggregatorSuite extends SparkFunSuite with MLlibTestSparkContext {
         val aggConstantFeature = getNewAggregator(instancesConstantFeature,
           Vectors.dense(coefArray ++ interceptArray), fitIntercept = true, isMultinomial = true)
         instances.foreach(aggConstantFeature.add)
    +
         // constant features should not affect gradient
    -    assert(aggConstantFeature.gradient(0) === 0.0)
    +    def validateGradient(grad: Vector): Unit = {
    +      assert(grad(0) === 0.0)
    +      grad.toArray.foreach { gradientValue =>
    --- End diff --
    
    The problem with this test was that it checked that part of the gradient was zero, but didn't check that the rest of the gradient was correct. Here, you're checking that the rest of the gradient isn't nan or infinite, but not that it's actually correct. A more appropriate test, IMO, is to also run an aggregator over the same instances with the constant feature filtered out, then check that the portion of the gradients they share are the same. e.g.
    
    ````scala
        val aggConstantFeature = getNewAggregator(instancesConstantFeature,
          Vectors.dense(coefArray ++ interceptArray), fitIntercept = true, isMultinomial = true)
        val filteredInstances = instancesConstantFeature.map { case Instance(l, w, f) =>
          Instance(l, w, Vectors.dense(f.toArray.tail))
        }
        val aggMultinomial = getNewAggregator(filteredInstances,
          Vectors.dense(coefArray.slice(3, 6) ++ interceptArray), fitIntercept = true,
          isMultinomial = true)
        filteredInstances.foreach(aggMultinomial.add)
        instancesConstantFeature.foreach(aggConstantFeature.add)
    
        // constant features should not affect gradient
        assert(aggConstantFeature.gradient.toArray.take(numClasses) === Array.fill(numClasses)(0.0))
        assert(aggMultinomial.gradient.toArray === aggConstantFeature.gradient.toArray.slice(3, 9))
    ````
    
    Just to note, this code is just for an example, not meant to be copy and pasted.


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    Merging with master and branch-2.2
    Thanks @WeichenXu123 @MLnick @sethah !


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    **[Test build #80680 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80680/testReport)** for PR 18896 at commit [`9339145`](https://github.com/apache/spark/commit/9339145f79b7eddd9455b64c63c9133ce35acd26).
     * 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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    LGTM except for making the test's title more descriptive.  Thanks!


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    **[Test build #80927 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80927/testReport)** for PR 18896 at commit [`1f4ba14`](https://github.com/apache/spark/commit/1f4ba14bf41f1cf05749bfc0951cd4844b00b861).
     * 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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    @WeichenXu123 would you mind sending a backport PR for 2.2?


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    Thanks @WeichenXu123 and @sethah !
    
    @WeichenXu123 I'd leave the MLOR test since it's cheap and has a clear purpose, even if it overlaps a little.
    
    LGTM
    @sethah any more comments before I merge 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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/80820/
    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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by MrBago <gi...@git.apache.org>.
Github user MrBago commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    @jkbradley please take a look when you get a chance.


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    How about updating the LogisticAggregatorSuite so it catches this error:
    ```
    diff --git a/mllib/src/test/scala/org/apache/spark/ml/optim/aggregator/LogisticAggregatorSuite.scala b/mllib/src/test/scala/org/apache/spark/ml/optim/aggregator/LogisticAggregatorSuite.scala
    index 2b29c67..a2924ad 100644
    --- a/mllib/src/test/scala/org/apache/spark/ml/optim/aggregator/LogisticAggregatorSuite.scala
    +++ b/mllib/src/test/scala/org/apache/spark/ml/optim/aggregator/LogisticAggregatorSuite.scala
    @@ -239,7 +239,14 @@ class LogisticAggregatorSuite extends SparkFunSuite with MLlibTestSparkContext {
           Vectors.dense(coefArray ++ interceptArray), fitIntercept = true, isMultinomial = true)
         instances.foreach(aggConstantFeature.add)
         // constant features should not affect gradient
    -    assert(aggConstantFeature.gradient(0) === 0.0)
    +    def validateGradient(grad: Vector): Unit = {
    +      assert(grad(0) === 0.0)
    +      grad.toArray.foreach { gradientValue =>
    +        assert(!gradientValue.isNaN &&
    +          gradientValue > Double.NegativeInfinity && gradientValue < Double.PositiveInfinity)
    +      }
    +    }
    +    validateGradient(aggConstantFeature.gradient)
     
         val binaryCoefArray = Array(1.0, 2.0)
         val intercept = 1.0
    @@ -248,6 +255,6 @@ class LogisticAggregatorSuite extends SparkFunSuite with MLlibTestSparkContext {
           isMultinomial = false)
         instances.foreach(aggConstantFeatureBinary.add)
         // constant features should not affect gradient
    -    assert(aggConstantFeatureBinary.gradient(0) === 0.0)
    +    validateGradient(aggConstantFeatureBinary.gradient)
       }
     }
    ```


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    **[Test build #80820 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80820/testReport)** for PR 18896 at commit [`5e73f63`](https://github.com/apache/spark/commit/5e73f63e239b3da6673115cf745ddbbabdedf7e6).


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    **[Test build #80708 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80708/testReport)** for PR 18896 at commit [`2eda876`](https://github.com/apache/spark/commit/2eda87658e655f9f4424d7ac621fd44ca6d0f0ed).


---
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 #18896: [SPARK-21681][ML] fix bug of MLOR do not work cor...

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

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


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/80680/
    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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    @jkkbradley OK. So I can remove the test I added ?


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    **[Test build #80820 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80820/testReport)** for PR 18896 at commit [`5e73f63`](https://github.com/apache/spark/commit/5e73f63e239b3da6673115cf745ddbbabdedf7e6).
     * 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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    **[Test build #80462 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80462/testReport)** for PR 18896 at commit [`c415dde`](https://github.com/apache/spark/commit/c415ddeb1182f8243e5330d294665079c21a8a19).


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by MLnick <gi...@git.apache.org>.
Github user MLnick commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    The model is always trained in the scaled space regardless of the `standardization` param.
    
    e.g. in the test case doing:
    ```scala
        val model = mlr.fit(multinomialDatasetWithZeroVar)
    
        println(model.interceptVector)
        println(model.coefficientMatrix)
    
        val model2 = mlr.setStandardization(false).fit(multinomialDatasetWithZeroVar)
    
        println(model2.interceptVector)
        println(model2.coefficientMatrix)
    ```
    
    Gives you
    ```
    [0.2659042827402973,0.5361544814545004,-0.8020587641947977]
    0.18818263258382864    0.0  
    -0.024143986869901088  0.0  
    -0.16403864571392754   0.0  
    [0.2659042827402915,0.5361544814544981,-0.8020587641947895]
    0.18818263258382964    0.0  
    -0.024143986869900692  0.0  
    -0.16403864571392893   0.0  
    ```


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on the issue:

    https://github.com/apache/spark/pull/18896
  
    @MLnick I debug the testcase your mentioned.
    The reason is, the zero var cause the computation generate `Infinite` and `NaN` so the result is unexpectable, in this case, it happened to generate 0.0 at gradient(0), so it escape the testcase.


---
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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    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 issue #18896: [SPARK-21681][ML] fix bug of MLOR do not work correctly ...

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

    https://github.com/apache/spark/pull/18896
  
    **[Test build #80708 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80708/testReport)** for PR 18896 at commit [`2eda876`](https://github.com/apache/spark/commit/2eda87658e655f9f4424d7ac621fd44ca6d0f0ed).
     * 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