-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG+1] ENH Ridge with solver SAG/SAGA does not cast to float64 #13302
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
[MRG+1] ENH Ridge with solver SAG/SAGA does not cast to float64 #13302
Conversation
872ebf5
to
5630c25
Compare
5630c25
to
c95f6ba
Compare
I get a segfall that I don't manage to reproduce |
assert results[np.float32].dtype == np.float32 | ||
assert results[np.float64].dtype == np.float64 | ||
assert_allclose(results[np.float32], results[np.float64], | ||
rtol=assert_tolerance) |
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.
The types are maintained but the numerical results are not stable. See:
~/code/scikit-learn is/ridge_regression_sag*
(mne) ❯ pytest sklearn/linear_model/tests/test_ridge.py -k dtype_stability -v --tb=no
Test session starts (platform: linux, Python 3.6.6, pytest 4.0.0, pytest-sugar 0.9.2)
cachedir: .pytest_cache
rootdir: /home/sik/code/scikit-learn, inifile: setup.cfg
plugins: sugar-0.9.2, pudb-0.7.0, mock-1.10.0, faulthandler-1.5.0, cov-2.6.0
collecting ...
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.1-svd] ✓ 4% ▌
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.1-cholesky] ✓ 8% ▉
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.1-lsqr] ✓ 12% █▍
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.1-sparse_cg] ✓ 17% █▋
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.1-sag] ✓ 21% ██▏
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.1-saga] ✓ 25% ██▌
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.01-svd] ✓ 29% ██▉
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.01-cholesky] ✓ 33% ███▍
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.01-lsqr] ✓ 38% ███▊
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.01-sparse_cg] ✓ 42% ████▎
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.01-sag] ⨯ 46% ████▋
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.01-saga] ✓ 50% █████
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.001-svd] ✓ 54% █████▌
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.001-cholesky] ✓ 58% █████▉
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.001-lsqr] ✓ 62% ██████▍
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.001-sparse_cg] ✓ 67% ██████▋
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.001-sag] ⨯ 71% ███████▏
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[0.001-saga] ⨯ 75% ███████▌
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[1e-06-svd] ✓ 79% ███████▉
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[1e-06-cholesky] ✓ 83% ████████▍
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[1e-06-lsqr] ⨯ 88% ████████▊
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[1e-06-sparse_cg] ✓ 92% █████████▎
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[1e-06-sag] ⨯ 96% █████████▋
sklearn/linear_model/tests/test_ridge.py::test_ridge_regression_dtype_stability[1e-06-saga] ⨯ 100% ██████████
Results (0.66s):
18 passed
6 failed
- sklearn/linear_model/tests/test_ridge.py:943 test_ridge_regression_dtype_stability[0.01-sag]
- sklearn/linear_model/tests/test_ridge.py:943 test_ridge_regression_dtype_stability[0.001-sag]
- sklearn/linear_model/tests/test_ridge.py:943 test_ridge_regression_dtype_stability[0.001-saga]
- sklearn/linear_model/tests/test_ridge.py:943 test_ridge_regression_dtype_stability[1e-06-lsqr]
- sklearn/linear_model/tests/test_ridge.py:943 test_ridge_regression_dtype_stability[1e-06-sag]
- sklearn/linear_model/tests/test_ridge.py:943 test_ridge_regression_dtype_stability[1e-06-saga]
49 deselected
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.
what is weird compared to #13309 is that svd
is stable
There are segfaults in the tests on azure :( |
@GaelVaroquaux :) yes! The thing is that |
I was trying to see which solver prefers which sparse configuration in our doc, and I could not find it: on the other side, when we use things like scipy's |
98c4eda
to
e3df1df
Compare
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.
LGTM.
+1 for MRG if CIs are green
please also update what's new
cross reference #11000 |
Test failures are legit and easy to fix: it's "RandomState", and not "randomstate" |
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.
LGTM aside from the randomstate issues in the test.
This seems to have approvals, but just needs finishing touches. Assuming we don't decide to squeeze it into 0.21 this week, what's new entry should be moved to 0.22. |
@jnothman @GaelVaroquaux I corrected the tests. Do you want to merge for 0.21 or 0.22. |
I think it should be fine to release, but we will need to start pulling together the list of issues for final release, and choose a date for release. |
closes #11642, (also closes #11643 by taking over)
build upon #11155
TODO:
Merge [MRG] LogisticRegression convert to float64 (sag) #11155 to reduce the diff.rebase master when LogisticRegression convert to float64 (for SAG solver) #13243 gets in