Skip to content

Commit

Permalink
BF: fixing seed in some tests that can fail randomly
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-taylor committed Sep 25, 2019
1 parent 3ea185b commit f01f3c0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion selectinf/algorithms/tests/test_lasso.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
except ImportError:
statsmodels_available = False

@set_seed_iftrue(True)
def test_gaussian(n=100, p=20):

y = np.random.standard_normal(n)
Expand Down Expand Up @@ -64,6 +65,7 @@ def test_gaussian(n=100, p=20):
np.dot(L.constraints.linear_part, L.onestep_estimator),
L.constraints.offset)

@set_seed_iftrue(True)
def test_sqrt_lasso(n=100, p=20):

y = np.random.standard_normal(n)
Expand Down Expand Up @@ -91,7 +93,7 @@ def test_sqrt_lasso(n=100, p=20):
np.dot(L.constraints.linear_part, L.onestep_estimator),
L.constraints.offset)


@set_seed_iftrue(True)
def test_logistic():

for Y, T in [(np.random.binomial(1,0.5,size=(10,)),
Expand All @@ -118,6 +120,7 @@ def test_logistic():

return L, C, P

@set_seed_iftrue(True)
def test_poisson():

X = np.random.standard_normal((10,5))
Expand All @@ -139,6 +142,7 @@ def test_poisson():

return L, C, P

@set_seed_iftrue(True)
@dec.skipif(not statsmodels_available, "needs statsmodels")
def test_coxph():

Expand Down

0 comments on commit f01f3c0

Please sign in to comment.