Skip to content

[MINOR][PYTHON] Fix MultilayerPerceptronClassifierTest.test_raw_and_probability_prediction#35997

Closed
harupy wants to merge 1 commit intoapache:masterfrom
harupy:fix-test_raw_and_probability_prediction-2
Closed

[MINOR][PYTHON] Fix MultilayerPerceptronClassifierTest.test_raw_and_probability_prediction#35997
harupy wants to merge 1 commit intoapache:masterfrom
harupy:fix-test_raw_and_probability_prediction-2

Conversation

@harupy
Copy link
Contributor

@harupy harupy commented Mar 29, 2022

What changes were proposed in this pull request?

https://github.com/apache/spark/runs/5725350556

Not equal to tolerance rtol=0.15, atol=1e-08

Mismatched elements: 3 / 3 (100%)
Max absolute difference: 4.39314499
Max relative difference: 0.23356037
 x: array([-14.190332, -10.063731,  26.570715])
 y: array([-11.608192,  -8.15828 ,  22.17757 ])

Why are the changes needed?

Does this PR introduce any user-facing change?

How was this patch tested?

@harupy harupy changed the title [MINOR][PYTHON] Fix MultilayerPerceptronClassifierTest.test_raw_and_probability_prediction [MINOR][PYTHON] Fix MultilayerPerceptronClassifierTest.test_raw_and_probability_prediction Mar 29, 2022
result.rawPrediction,
expected_rawPrediction,
rtol=0.15,
rtol=0.3,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test

import numpy as np

a = np.array([-14.190332, -10.063731, 26.570715])
b = np.array([-11.608192, -8.15828, 22.17757])

atol = 1e-08
print(np.max((np.abs(a - b) - atol) / np.abs(b)))  # 0.2335603816000433

rtol = 0.3
np.testing.assert_allclose(a, b, rtol=rtol, atol=rtol)

@HyukjinKwon
Copy link
Member

im gonna merge this first, and montior if the test is still flaky.

@HyukjinKwon
Copy link
Member

Merged to master and branch-3.3.

HyukjinKwon pushed a commit that referenced this pull request Mar 29, 2022
…probability_prediction`

### What changes were proposed in this pull request?

- A follow-up for #35778
- Increase `rtol` to de-flake the test.

https://github.com/apache/spark/runs/5725350556

```
Not equal to tolerance rtol=0.15, atol=1e-08

Mismatched elements: 3 / 3 (100%)
Max absolute difference: 4.39314499
Max relative difference: 0.23356037
 x: array([-14.190332, -10.063731,  26.570715])
 y: array([-11.608192,  -8.15828 ,  22.17757 ])
```

### Why are the changes needed?

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

Closes #35997 from harupy/fix-test_raw_and_probability_prediction-2.

Authored-by: Harutaka Kawamura <hkawamura0130@gmail.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
(cherry picked from commit 264dbd7)
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
@dongjoon-hyun
Copy link
Member

Thank you, @harupy and @HyukjinKwon .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants