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. |
NicolasHug
left a comment
There was a problem hiding this comment.
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.
300 seeds seems a bit too much.
There was a problem hiding this comment.
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
agramfort
left a comment
There was a problem hiding this comment.
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) |
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
RidgeCVcannot be included since it does not support individual penalties.after IRL with @ogrisel