Skip to content

⚠️ CI failed on Linux_Runs.pylatest_conda_forge_mkl (last failure: Apr 26, 2025) ⚠️ #31256

Closed

Description

@scikit-learn-bot

CI failed on Linux_Runs.pylatest_conda_forge_mkl (Apr 26, 2025)

  • test_precomputed_nearest_neighbors_filtering[60]

Activity

  1. added
    Needs Triage
    on Apr 26, 2025
  2. scikit-learn-bot commented on Apr 27, 2025

    @scikit-learn-bot
    ContributorAuthor

    CI is no longer failing! ✅

    Successful run on Apr 30, 2025

  3. ogrisel commented on Apr 28, 2025

    @ogrisel
    Member

    For the record, the failure was the following:

    _______________ test_precomputed_nearest_neighbors_filtering[60] _______________
    [gw0] linux -- Python 3.13.3 /usr/share/miniconda/envs/testvenv/bin/python
    
    global_random_seed = 60
    
        def test_precomputed_nearest_neighbors_filtering(global_random_seed):
            # Test precomputed graph filtering when containing too many neighbors
            X, y = make_blobs(
                n_samples=250,
                random_state=global_random_seed,
                centers=[[1, 1], [-1, -1]],
                cluster_std=0.01,
            )
        
            n_neighbors = 2
            results = []
            for additional_neighbors in [0, 10]:
                nn = NearestNeighbors(n_neighbors=n_neighbors + additional_neighbors).fit(X)
                graph = nn.kneighbors_graph(X, mode="connectivity")
                labels = (
                    SpectralClustering(
                        random_state=global_random_seed,
                        n_clusters=2,
                        affinity="precomputed_nearest_neighbors",
                        n_neighbors=n_neighbors,
                    )
                    .fit(graph)
                    .labels_
                )
                results.append(labels)
        
    >       assert_array_equal(results[0], results[1])
    E       AssertionError: 
    E       Arrays are not equal
    E       
    E       Mismatched elements: 139 / 250 (55.6%)
    E       Max absolute difference among violations: 1
    E       Max relative difference among violations: 1.
    E        ACTUAL: array([1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1,
    E              0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
    E              1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1,...
    E        DESIRED: array([1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1,
    E              0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,
    E              0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1,...
    
    X          = array([[ 0.98723448,  0.9898586 ],
           [-1.00258762, -1.00697942],
           [ 0.98726373,  0.99184863],
           [ 0.98... 0.9927963 ],
           [-1.0010091 , -1.00391894],
           [ 1.01668103,  1.01155459],
           [-1.00678887, -0.99002748]])
    additional_neighbors = 10
    global_random_seed = 60
    graph      = <Compressed Sparse Row sparse matrix of dtype 'float64'
    	with 3000 stored elements and shape (250, 250)>
    labels     = array([1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1,
           0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0,...,
           0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1,
           0, 1, 0, 0, 1, 1, 1, 0], dtype=int32)
    n_neighbors = 2
    nn         = NearestNeighbors(n_neighbors=12)
    results    = [array([1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1,
           0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1...
           0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1,
           0, 1, 0, 0, 1, 1, 1, 0], dtype=int32)]
    y          = array([0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
           0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1,...1, 1, 0, 0, 0,
           1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0,
           1, 0, 0, 0, 0, 1, 0, 1])
    
    ../1/s/sklearn/cluster/tests/test_spectral.py:130: AssertionError
  4. ogrisel commented on Apr 28, 2025

    @ogrisel
    Member

    I ran locally (on arm64 macOS) this test will all admissible random seeds and it passes for me. So this is likely a case of platform/rng seed cross-sensitivity.

  5. added
    module:test-suite
    and removed
    Needs Triage
    on Apr 28, 2025
  6. adrinjalali commented on Apr 30, 2025

    @adrinjalali
    Member

    Fixed by #31262

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    module:test-suite

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions