Skip to content

⚠️ CI failed on Unit tests Linux pymin_conda_forge_arm (last failure: Aug 12, 2026) ⚠️ #34732

Closed

Description

@scikit-learn-bot

Warning

This issue is not yet ready for a PR. If you are interested in contributing to scikit-learn, please have a look at our contributing guidelines, and in particular the sections for new contributors and the "Needs triage" label.

CI failed on Unit tests Linux pymin_conda_forge_arm (Aug 12, 2026)

  • test_cython_solver_early_stopping[enet]

Activity

  1. added
    Needs Triage
    on Aug 12, 2026
  2. scikit-learn-bot commented on Aug 13, 2026

    @scikit-learn-bot
    ContributorAuthor

    CI is no longer failing! ✅

    Successful run on Oct 03, 2026

  3. lesteve commented on Aug 13, 2026

    @lesteve
    Member

    August 12 build log probably a numerical instability on arm (there is no global random seed). Weird that it is not deterministic though 🤔.

    FAILED linear_model/tests/test_coordinate_descent.py::test_cython_solver_early_stopping[enet] - assert np.int64(22) > (100 / 4)
    
    ___________________ test_cython_solver_early_stopping[enet] ____________________
    [gw3] linux -- Python 3.11.15 /home/runner/miniconda3/envs/testvenv/bin/python
    
    cd = 'enet'
    
        @pytest.mark.parametrize("cd", ["enet", "sparse_enet", "enet_gram", "enet_multi"])
        def test_cython_solver_early_stopping(cd):
            """Test that early_stopping works correctly."""
            X, y = make_regression()
            X_mean = X.mean(axis=0)
            X_centered = np.asfortranarray(X - X_mean)
            y -= y.mean()
            alpha_max = np.linalg.norm(X.T @ y, ord=np.inf)
            params = {
                "alpha": alpha_max / 100,
                "beta": 0,
                "max_iter": 100,
                "tol": 1e-1,  # Set a high value on purpose.
                "rng": np.random.RandomState(0),  # not used, but needed as argument
                "random": False,
            }
            if cd == "enet":
                cd_solve = partial(
                    cd_fast.enet_coordinate_descent,
                    X=X_centered,
                    y=y,
                    **params,
                )
            elif cd == "sparse_enet":
                Xs = sparse.csc_matrix(X)
                cd_solve = partial(
                    cd_fast.enet_coordinate_descent_sparse,
                    X_data=Xs.data,
                    X_indices=Xs.indices,
                    X_indptr=Xs.indptr,
                    y=y,
                    sample_weight=None,
                    X_mean=X_mean,
                    **params,
                )
            elif cd == "enet_gram":
                cd_solve = partial(
                    cd_fast.enet_coordinate_descent_gram,
                    Q=X_centered.T @ X_centered,
                    q=X_centered.T @ y,
                    y=y,
                    **params,
                )
            elif cd == "enet_multi":
        
                def cd_solve(w, early_stopping=True):
                    return cd_fast.enet_coordinate_descent_multi_task(
                        W=w,
                        X=X_centered,
                        X_is_sparse=False,
                        X_data=None,
                        X_indices=None,
                        X_indptr=None,
                        Y=np.asfortranarray(np.c_[y, y]),
                        sample_weight=None,
                        X_mean=None,
                        **params,
                        early_stopping=early_stopping,
                    )
        
            if cd == "enet_multi":
                coef_1 = np.zeros((2, X.shape[1]), order="F")
            else:
                coef_1 = np.zeros(X.shape[1])
            _, gap_1, _, _ = cd_solve(w=coef_1)
    >       assert np.sum(coef_1 != 0) > X.shape[1] / 4  # avoid all zeros
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    E       assert np.int64(22) > (100 / 4)
    E        +  where np.int64(22) = <function sum at 0xffbb9ce450f0>(array([ 6.72111447e+01, -0.00000000e+00,  0.00000000e+00, -0.00000000e+00,\n       -0.00000000e+00,  0.00000000e+00,  0...8475e-01,  0.00000000e+00,  0.00000000e+00,\n       -0.00000000e+00, -0.00000000e+00, -0.00000000e+00,  1.23869733e+01]) != 0)
    E        +    where <function sum at 0xffbb9ce450f0> = np.sum
    
    X          = array([[ 1.49541107,  1.47523453, -0.58747444, ..., -0.87848393,
            -0.41693228, -0.12007016],
           [ 0.3860073...
           [ 2.62622869,  0.10339143,  1.0613507 , ..., -0.18295922,
             0.91115313,  2.64295054]], shape=(100, 100))
    X_centered = array([[ 1.51809964,  1.48980845, -0.70746482, ..., -0.99299021,
            -0.45575788, -0.23840132],
           [ 0.4086958...
           [ 2.64891726,  0.11796536,  0.94136031, ..., -0.2974655 ,
             0.87232753,  2.52461939]], shape=(100, 100))
    X_mean     = array([-2.26885668e-02, -1.45739284e-02,  1.19990387e-01, -4.72628435e-02,
            9.58274739e-02, -1.11773880e-02,  1...2190e-02,  1.23121691e-01,  3.85450332e-02,
            2.95673983e-01,  1.14506281e-01,  3.88255950e-02,  1.18331151e-01])
    _          = 4
    alpha_max  = np.float64(13988.398585117147)
    cd         = 'enet'
    cd_solve   = functools.partial(<cyfunction enet_coordinate_descent at 0xffbb840eb370>, X=array([[ 1.51809964,  1.48980845, -0.70746...p.float64(139.88398585117147), beta=0, max_iter=100, tol=0.1, rng=RandomState(MT19937) at 0xFFBB69DE0940, random=False)
    coef_1     = array([ 6.72111447e+01, -0.00000000e+00,  0.00000000e+00, -0.00000000e+00,
           -0.00000000e+00,  0.00000000e+00,  0...8475e-01,  0.00000000e+00,  0.00000000e+00,
           -0.00000000e+00, -0.00000000e+00, -0.00000000e+00,  1.23869733e+01])
    gap_1      = 44747.933132160106
    params     = {'alpha': np.float64(139.88398585117147), 'beta': 0, 'max_iter': 100, 'tol': 0.1, ...}
    y          = array([  27.03346035, -122.89536509,  125.32107976, -178.66881874,
           -112.48704113,  143.34191366, -254.13739843,...79908,  -28.13054445, -228.41377568,  116.22337214,
             74.67330745,  -28.24454687, -588.88906126,  307.70852151])
    
    ../sklearn/linear_model/tests/test_coordinate_descent.py:238: AssertionError
    
  4. shnhdan commented on Aug 20, 2026

    @shnhdan

    Looking into this, the root cause appears to be that make_regression() on line 176 is called without a random_state, so the generated data differs on every run (and across pytest-xdist workers — this failure occurred on [gw3]). The > X.shape[1] / 4 threshold isn't guaranteed to hold for every random draw — this run landed at 22/100 nonzero coefficients, which points to an unfavorable draw rather than a solver bug.

    Possible next steps:

    • Add a fixed random_state to make_regression() (e.g. random_state=0) to make the test deterministic, and verify the fix by running it repeatedly with that seed to confirm it clears the threshold with a reasonable margin rather than barely.
    • Optionally relax the threshold slightly as an additional safeguard.

    Would this be the right approach, or did you have something else in mind for addressing this?

    Would be happy to open a PR with the fix if no one's working on it.

  5. lesteve commented on Aug 20, 2026

    @lesteve
    Member

    Indeed the missing random_state in make_regression could be one of the reason:

    This was added in #34336 so ccing @lorentzenchr and @OmarManzoor for an informed opinion about what their preferred approach is. Here are a few options I can see:

    • fixed random seed
    • use global_random_seed to make sure the test is not to sensitive to random seed
    • raise threshold
    • something else
  6. added
    Needs Investigation
    and removed
    Needs Triage
    on Aug 25, 2026
  7. lorentzenchr commented on Sep 7, 2026

    @lorentzenchr
    Member

    Simple solution:

    assert np.sum(coef_1 != 0) > max(2, X.shape[1] / 10)  # avoid all zeros
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

    BugNeeds Investigation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions