Skip to content

MAINT: Skip linear regression test that fails due to tolerances#3113

Open
david-cortes-intel wants to merge 1 commit intouxlfoundation:mainfrom
david-cortes-intel:skip_lstsq
Open

MAINT: Skip linear regression test that fails due to tolerances#3113
david-cortes-intel wants to merge 1 commit intouxlfoundation:mainfrom
david-cortes-intel:skip_lstsq

Conversation

@david-cortes-intel
Copy link
Copy Markdown
Contributor

Description

Skips a test from scikit-learn that has been producing failures in multiple jobs when the runner is an AMD machine without avx512.

Example:

================================== FAILURES ===================================
__________________ test_linear_regression_vs_lstsq[float32] ___________________

dtype = <class 'numpy.float32'>

    @pytest.mark.parametrize("dtype", [np.float64, np.float32])
    def test_linear_regression_vs_lstsq(dtype):
        """
        Check that LinearRegression is as good as `scipy.linalg.lstsq`.
        Non regression test for issue #33032.
        """
        rng = np.random.RandomState(1137)
        n_samples = 500_000
    
        x1 = rng.rand(n_samples)
        x2 = 0.3 * x1 + 0.1 * rng.rand(n_samples)
        X = np.column_stack([x1, x2])
        y = X @ [0.5, 2.0] + 0.1 * rng.rand(n_samples)
    
        X = X.astype(dtype)
        y = y.astype(dtype)
    
        coef_scipy = linalg.lstsq(X, y)[0]
        coef_sklearn = LinearRegression(fit_intercept=False).fit(X, y).coef_
    
        rmse_scipy = np.linalg.norm(y - X @ coef_scipy)
        rmse_sklearn = np.linalg.norm(y - X @ coef_sklearn)
>       assert rmse_sklearn == pytest.approx(rmse_scipy, rel=1e-6)
E       assert np.float32(24.387865) == 24.38691520690918 � 2.4e-05
E         
E         comparison failed
E         Obtained: 24.38786506652832
E         Expected: 24.38691520690918 � 2.4e-05

Link: https://dev.azure.com/daal/daal4py/_build/results?buildId=58488&view=logs&j=950f1d62-c3cc-5d51-08d2-e6dd47db1841&t=aaee886b-1c31-541e-c596-9c472f025343&l=31285


Checklist:

Completeness and readability

  • I have commented my code, particularly in hard-to-understand areas.
  • Git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details).
  • I have resolved any merge conflicts that might occur with the base branch.

Testing

  • I have run it locally and tested the changes extensively.
  • All CI jobs are green or I have provided justification why they aren't.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
azure 79.65% <ø> (ø)
github 81.98% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

sklearn-patch sklearn patching

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant