Skip to content

Commit

Permalink
[MINOR][TESTS] Increase tolerance to 0.2 for NaiveBayesSuite
Browse files Browse the repository at this point in the history
### 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 apache#31266 from Loquats/NaiveBayesSuite-reltol.

Authored-by: Andy Zhang <yue.zhang@databricks.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
  • Loading branch information
Loquats authored and dongjoon-hyun committed Jan 21, 2021
1 parent e9e81f7 commit c8c70d5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c8c70d5

Please sign in to comment.