-
-
Notifications
You must be signed in to change notification settings - Fork 25k
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
TST add test to check that all ridge solver give the same results #13914
TST add test to check that all ridge solver give the same results #13914
Conversation
@jeromedockes do you time to also look at #13246 there is also there a problem with Ridge that is still different between dense and sparse |
yes, as far as I can tell the It seems that at the moment, only the the test that currently should check that I am planning to work on this and open a PR soon. |
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.
Tests run pretty fast (about 1sec) so LGTM
…lvers_consistency
Ridge docstring says it is more stable than cholesky
'n_samples,dtype,proportion_nonzero', | ||
[(20, 'float32', .1), (40, 'float32', 1.), (20, 'float64', .2)]) | ||
@pytest.mark.parametrize('sparse_X', [True, False]) | ||
@pytest.mark.parametrize('seed', np.arange(300)) |
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.
300 seeds seems a bit too much.
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.
my apologies about that, I had wanted to check with many seeds locally and
forgot to reduce the number of seeds afterwards. I set it to 3 now
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.
besides maybe a too ambitious/slow test LGTM. +1 for MRG
Can I merge this one? |
svd_ridge = Ridge( | ||
solver='svd', normalize=True, alpha=alpha).fit(X, y) | ||
X = X.astype(dtype) | ||
y = y.astype(dtype) |
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.
Add copy=False
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.
Thanks @jeromedockes !
thanks for your help! |
There lacks a test checking that all the ridge solvers (including the gcv) give similar results for a few different datasets (varying shapes, float32/64, and sparsity)
this test:
scikit-learn/sklearn/linear_model/tests/test_ridge.py
Line 290 in 0a2dc72
compares solvers but for only one dense dataset with null coefficients and no intercept, and is meant to test individual penalties on outputs, so
RidgeCV
cannot be included since it does not support individual penalties.after IRL with @ogrisel