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