You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/05/27 13:29:21 UTC

[GitHub] [spark] srowen commented on a change in pull request #32673: [SPARK-35530][ML][TESTS] Fix rounding error in DifferentiableLossAggregatorSuite with Java 11

srowen commented on a change in pull request #32673:
URL: https://github.com/apache/spark/pull/32673#discussion_r640624191



##########
File path: mllib/src/test/scala/org/apache/spark/ml/optim/aggregator/DifferentiableLossAggregatorSuite.scala
##########
@@ -149,10 +152,43 @@ object DifferentiableLossAggregatorSuite {
 
     override def add(instance: Instance): TestAggregator = {
       val error = instance.label - BLAS.dot(coefficients, instance.features)
-      weightSum += instance.weight
-      lossSum += instance.weight * error * error / 2.0
-      (0 until dim).foreach { j =>
-        gradientSumArray(j) += instance.weight * error * instance.features(j)
+      val mathCls = Utils.classForName("java.lang.Math")

Review comment:
       An approximate equality test is appropriate here. I'm not sure why it varies in Java 11, but I could imagine tiny differences are possible. This is OK.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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