HyukjinKwon commented on a change in pull request #32673: URL: https://github.com/apache/spark/pull/32673#discussion_r640329780
########## 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: @sarutak, I think we can just fix the test with tolerance e.g.) `assert(agg.weight ~== weightSum relTol 1e-5)` like the above one or https://github.com/apache/spark/blob/master/mllib/src/test/scala/org/apache/spark/ml/tuning/RandomRangesSuite.scala#L37 Up to my knowledge, this kind of precision diff is a common problem in ML side. cc @srowen, @WeichenXu123 @zhengruifeng FYI ########## 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: @sarutak, I think we can just fix the test with tolerance at the assertion e.g.) `assert(agg.weight ~== weightSum relTol 1e-5)` like the above one or https://github.com/apache/spark/blob/master/mllib/src/test/scala/org/apache/spark/ml/tuning/RandomRangesSuite.scala#L37 Up to my knowledge, this kind of precision diff is a common problem in ML side. cc @srowen, @WeichenXu123 @zhengruifeng FYI -- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org