8000 Make test_ridge_regression_dtype_stability less random by ogrisel · Pull Request #13816 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

Make test_ridge_regression_dtype_stability less random #13816

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

Conversation

ogrisel
Copy link
Member
@ogrisel ogrisel commented May 7, 2019

As reported in #13350 (comment) a new test introduced in #13302 tend to fail randomly when changing the seed (also one of the rng used internally was a module level singleton which caused the tests to be dependent on other tests).

I changed the test criterion to work with a wide variety of random problems (I tried all seed in range(100)).

I have observed a few catastrophic failures with sparse_cg in float32: some coefs could have very large magnitude. Maybe we should disable float32 bit data for sparse_cg.

@ogrisel ogrisel added this to the 0.21 milestone May 7, 2019
@ogrisel
Copy link
Member Author
ogrisel commented May 7, 2019

Note that this test in one of the 2 tests that currently fail on the travis CRON job:

https://travis-ci.org/scikit-learn/scikit-learn/builds/529275776

Copy link
Member
@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabling float32, or upcasting, seems a reasonable interim solution?

@@ -998,16 +998,18 @@ def test_dtype_match_cholesky():

@pytest.mark.parametrize(
'solver', ['svd', 'cholesky', 'lsqr', 'sparse_cg', 'sag', 'saga'])
def test_ridge_regression_dtype_stability(solver):
random_state = np.random.RandomState(0)
@pytest.mark.parametrize('seed', range(1))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This range looks a bit funny

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's meant to make it easy to edit this test to run on 100s of different seeds. We probably need a more generic way to achieve this with a fixture.

@jnothman jnothman merged commit ff2f923 into scikit-learn:master May 8, 2019
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request May 8, 2019
@ogrisel ogrisel deleted the avoid-random-failure-in-test_ridge_regression_dtype_stability branch May 9, 2019 09:02
@jnothman
Copy link
Member
jnothman commented May 9, 2019 via email

koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0