You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2021/01/21 00:38:58 UTC

[spark] branch branch-3.1 updated: [MINOR][TESTS] Increase tolerance to 0.2 for NaiveBayesSuite

This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new dad201e  [MINOR][TESTS] Increase tolerance to 0.2 for NaiveBayesSuite
dad201e is described below

commit dad201e05d100021ab504a775684e5a31d3b04c7
Author: Andy Zhang <yu...@databricks.com>
AuthorDate: Wed Jan 20 16:38:01 2021 -0800

    [MINOR][TESTS] Increase tolerance to 0.2 for NaiveBayesSuite
    
    ### What changes were proposed in this pull request?
    This test fails flakily. I found it failing in 1 out of 80 runs.
    ```
      Expected -0.35667494393873245 and -0.41914521201224453 to be within 0.15 using relative tolerance.
    ```
    Increasing relative tolerance to 0.2 should improve flakiness.
    ```
    0.2 * 0.35667494393873245 = 0.071 > 0.062 = |-0.35667494393873245 - (-0.41914521201224453)|
    ```
    
    ### Why are the changes needed?
    
    ### Does this PR introduce _any_ user-facing change?
    
    ### How was this patch tested?
    
    Closes #31266 from Loquats/NaiveBayesSuite-reltol.
    
    Authored-by: Andy Zhang <yu...@databricks.com>
    Signed-off-by: Dongjoon Hyun <dh...@apple.com>
    (cherry picked from commit c8c70d50026a8ed0b202f456b02df5adc905c4f7)
    Signed-off-by: Dongjoon Hyun <dh...@apple.com>
---
 .../scala/org/apache/spark/mllib/classification/NaiveBayesSuite.scala | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mllib/src/test/scala/org/apache/spark/mllib/classification/NaiveBayesSuite.scala b/mllib/src/test/scala/org/apache/spark/mllib/classification/NaiveBayesSuite.scala
index c206747..4de1084 100644
--- a/mllib/src/test/scala/org/apache/spark/mllib/classification/NaiveBayesSuite.scala
+++ b/mllib/src/test/scala/org/apache/spark/mllib/classification/NaiveBayesSuite.scala
@@ -107,9 +107,9 @@ class NaiveBayesSuite extends SparkFunSuite with MLlibTestSparkContext {
     val modelIndex = piData.indices.zip(model.labels.map(_.toInt))
     try {
       for (i <- modelIndex) {
-        assert(piData(i._2) ~== model.pi(i._1) relTol 0.15)
+        assert(piData(i._2) ~== model.pi(i._1) relTol 0.2)
         for (j <- thetaData(i._2).indices) {
-          assert(thetaData(i._2)(j) ~== model.theta(i._1)(j) relTol 0.15)
+          assert(thetaData(i._2)(j) ~== model.theta(i._1)(j) relTol 0.2)
         }
       }
     } catch {


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