Skip to content

⚠️ CI failed on Linux_free_threaded.pylatest_pip_free_threaded (last failure: Jun 14, 2024) ⚠️ #29253

Closed

Description

@scikit-learn-bot

CI failed on Linux_free_threaded.pylatest_pip_free_threaded (Jun 14, 2024)

  • test_minibatch_sensible_reassign[34]

Activity

  1. added
    Needs Triage
    on Jun 14, 2024
  2. ogrisel commented on Jun 14, 2024

    @ogrisel
    Member

    This might be a seed sensitivity problem of this test. We need to see if we can reproduce with other Python versions / platforms.

    The error is:

        def test_minibatch_sensible_reassign(global_random_seed):
            # check that identical initial clusters are reassigned
            # also a regression test for when there are more desired reassignments than
            # samples.
            zeroed_X, true_labels = make_blobs(
                n_samples=100, centers=5, random_state=global_random_seed
            )
            zeroed_X[::2, :] = 0
        
            km = MiniBatchKMeans(
                n_clusters=20, batch_size=10, random_state=global_random_seed, init="random"
            ).fit(zeroed_X)
            # there should not be too many exact zero cluster centers
    >       assert km.cluster_centers_.any(axis=1).sum() > 10
    E       AssertionError

    any idea why pytest's AssertionError no longer display the values of the two expressions on each side of an binary operator?

  3. lesteve commented on Jun 14, 2024

    @lesteve
    Member

    The test_minibatch_sensible_reassign failure has been seen in other CI builds #27967 (comment) or #26802 (comment)

    Not sure about why pytest does not manage to give more information about the AssertionError ... same thing happens on vanilla Python in our CI e.g. this build log

  4. added and removed
    Needs Triage
    on Jun 14, 2024
  5. ogrisel commented on Jun 14, 2024

    @ogrisel
    Member

    I tried to reproduce locally with either openblas or accelerate:

    SKLEARN_TESTS_GLOBAL_RANDOM_SEED="all"  pytest -k test_minibatch_sensible_reassign sklearn/cluster/tests/test_k_means.py -v
    

    but I cannot reproduce the assertion failure after several runs including when using pytest-xdist for different concurrency-induced non-deterministic execution patterns.

  6. scikit-learn-bot commented on Jun 15, 2024

    @scikit-learn-bot
    ContributorAuthor

    CI is no longer failing! ✅

    Successful run on Jun 20, 2024

  7. ogrisel commented on Jun 17, 2024

    @ogrisel
    Member

    I had a look at the test and the threshold of 10 non-reassignments (over 20 clusters) does not seem particularly well justified.

    However, by adding print statements on my local machines I consistently see values in the 14-19 range, so there might still be a platform-specific discrepancy that could explain reaching 10.

    Still we might want to move the threshold to 8 instead of 10 to silence this failure (potentially at the cost of making this test a bit too weak).

  8. lesteve commented on Jun 17, 2024

    @lesteve
    Member

    I can not reproduce either locally even using a lock-file to try to be as close as possible to the CI.

    I do manage to reproduce in the CI, see #29278. I really don't get it, I changed the code to have more information but the error message with the assertion is not reflecting this 😱. I got it it, rookie mistake on my part 😅.

  9. lesteve commented on Jun 17, 2024

    @lesteve
    Member

    And I think that the reason why there is not more info in the assertion message is because of an issue with Pytest assertion rewriting with editable install 🤕, maybe pytest-dev/pytest#11783 but I don't think so ...

    This may also be a quirk of meson editable installs, not sure ...

    What I have checked is that a Meson non-editable install works with Pytest assertion rewriting, a meson editable install does not.

  10. lesteve commented on Jul 3, 2024

    @lesteve
    Member

    FYI I ended up opening an issue about Pytest assertion rewriting and meson ediable install in mesonbuild/meson-python#646

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions