Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: LinearRegressionwithErrors testing is not roboust enough #260

Open
bsipocz opened this issue May 17, 2022 · 0 comments
Open

BUG: LinearRegressionwithErrors testing is not roboust enough #260

bsipocz opened this issue May 17, 2022 · 0 comments

Comments

@bsipocz
Copy link
Member

bsipocz commented May 17, 2022

This maybe a sign of underlying bugs or simply just the tests are not tolerant enough. But I see this particular test function to fail occasionally.

=================================== FAILURES ===================================
_______________________ test_LinearRegressionwithErrors ________________________

    @pytest.mark.skipif('not HAS_PYMC3')
    def test_LinearRegressionwithErrors():
        """
        Test for small errors agrees with fit with y errors only
        """
    
        from astroML.linear_model import LinearRegressionwithErrors
    
        np.random.seed(0)
        X = np.random.random(10) + 1
        dy = np.random.random(10) * 0.1
        y = X * 2 + 1 + (dy - 0.05)
        dx = np.random.random(10) * 0.01
        X = X + (dx - 0.005)
    
        clf1 = LinearRegression().fit(X[:, None], y, dy)
        clf2 = LinearRegressionwithErrors().fit(np.atleast_2d(X), y, dy, dx)
    
>       assert_allclose(clf1.coef_, clf2.coef_, 0.2)
E       AssertionError: 
E       Not equal to tolerance rtol=0.2, atol=0
E       
E       Mismatched elements: 1 / 2 (50%)
E       Max absolute difference: 0.1610982
E       Max relative difference: 0.20502224
E        x: array([0.946858, 2.008877])
E        y: array([0.78576 , 2.099291])

../../astroML/linear_model/tests/test_linear_regression.py:140: AssertionError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant