@@ -1978,7 +1978,9 @@ def test_lbfgs_solver_error():
1978
1978
@pytest .mark .parametrize ("sparseX" , [False , True ])
1979
1979
@pytest .mark .parametrize ("data" , ["tall" , "wide" ])
1980
1980
@pytest .mark .parametrize ("solver" , SOLVERS + ["lbfgs" ])
1981
- def test_ridge_sample_weight_consistency (fit_intercept , sparseX , data , solver ):
1981
+ def test_ridge_sample_weight_consistency (
1982
+ fit_intercept , sparseX , data , solver , global_random_seed
1983
+ ):
1982
1984
"""Test that the impact of sample_weight is consistent.
1983
1985
1984
1986
Note that this test is stricter than the common test
@@ -1989,6 +1991,9 @@ def test_ridge_sample_weight_consistency(fit_intercept, sparseX, data, solver):
1989
1991
if solver == "svd" or (solver in ("cholesky" , "saga" ) and fit_intercept ):
1990
1992
pytest .skip ("unsupported configuration" )
1991
1993
1994
+ # XXX: this test is quite sensitive to the seed used to generate the data:
1995
+ # ideally we would like the test to pass for any global_random_seed but this is not
1996
+ # the case at the moment.
1992
1997
rng = np .random .RandomState (42 )
1993
1998
n_samples = 12
1994
1999
if data == "tall" :
@@ -2005,6 +2010,7 @@ def test_ridge_sample_weight_consistency(fit_intercept, sparseX, data, solver):
2005
2010
alpha = 1.0 ,
2006
2011
solver = solver ,
2007
2012
positive = (solver == "lbfgs" ),
2013
+ random_state = global_random_seed , # for sag/saga
2008
2014
tol = 1e-12 ,
2009
2015
)
2010
2016
0 commit comments