Skip to content

Conversation

ogrisel
Copy link
Member

@ogrisel ogrisel commented Aug 28, 2025

Closes #27846.

@ogrisel ogrisel added Build / CI module:test-suite everything related to our tests Quick Review For PRs that are quick to review labels Aug 28, 2025
Copy link

github-actions bot commented Aug 28, 2025

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 0287379. Link to the linter CI: here

@ogrisel
Copy link
Member Author

ogrisel commented Aug 28, 2025

Hum.

assert_allclose(Xt[np.float32], Xt[np.float64], atol=Xt[np.float64].max() * rtol)

fails for seed 33 on the ubuntu atlas build with:

E           AssertionError: 
E           Not equal to tolerance rtol=0.0001, atol=0.00222324
E           
E           Mismatched elements: 180 / 800 (22.5%)
E           Max absolute difference: 0.04510504
E           Max relative difference: 0.02222245
E            x: array([[ 7.528463,  5.820543,  3.035802,  1.845218,  7.03596 ,  6.36431 ,
E                    6.242327,  1.122712],
E                  [ 2.215386,  5.555049, 10.260398,  8.833364,  2.335838,  5.359241,...
E            y: array([[ 7.52846 ,  5.820543,  3.035804,  1.862278,  7.035962,  6.364307,
E                    6.242327,  1.118434],
E                  [ 2.215385,  5.55505 , 10.260399,  8.846413,  2.335837,  5.359238,...

This seems well above the expected floating point rounding errors...

@ogrisel
Copy link
Member Author

ogrisel commented Aug 28, 2025

I cannot reproduce locally, so maybe it's BLAS-implementation specific.

@ogrisel
Copy link
Member Author

ogrisel commented Aug 28, 2025

Let's skip this test on Atlas.

@@ -794,6 +795,13 @@ def test_k_means_function(global_random_seed):
ids=data_containers_ids,
)
@pytest.mark.parametrize("Estimator", [KMeans, MiniBatchKMeans])
@pytest.mark.skipif(
not [i for i in threadpool_info() if i["user_api"] == "blas"],
Copy link
Member

Choose a reason for hiding this comment

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

more readable imo

Suggested change
not [i for i in threadpool_info() if i["user_api"] == "blas"],
not any(i for i in threadpool_info() if i["user_api"] == "blas"),

@@ -822,10 +830,11 @@ def test_float_precision(Estimator, input_data, global_random_seed):

# compare arrays with low precision since the difference between 32 and
# 64 bit comes from an accumulation of rounding errors.
assert_allclose(inertia[np.float32], inertia[np.float64], rtol=1e-4)
assert_allclose(Xt[np.float32], Xt[np.float64], atol=Xt[np.float64].max() * 1e-4)
rtol = 2e-4
Copy link
Member

Choose a reason for hiding this comment

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

do we still need the increased rtol then ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build / CI module:cluster module:test-suite everything related to our tests No Changelog Needed Quick Review For PRs that are quick to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

⚠️ CI failed on Ubuntu_Atlas.ubuntu_atlas (last failure: Aug 28, 2025) ⚠️
2 participants