-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
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
Make test_ridge_regression_dtype_stability less random #13816
Conversation
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 |
There was a problem hiding this 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)) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
We could have a random_seed pytest.fixture that is different on different
ci?
|
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
infloat32
: some coefs could have very large magnitude. Maybe we should disable float32 bit data forsparse_cg
.