Skip to content

Commit 6d5f816

Browse files
NicolasHugqinhanmin2014
authored andcommitted
TST Fix test_sag_regressor by setting random_state (scikit-learn#13506)
1 parent 4921f9d commit 6d5f816

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

sklearn/linear_model/tests/test_sag.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,13 +452,12 @@ def test_get_auto_step_size():
452452
max_squared_sum_, alpha, "wrong", fit_intercept)
453453

454454

455-
@pytest.mark.filterwarnings('ignore:The max_iter was reached')
456455
def test_sag_regressor():
457456
"""tests if the sag regressor performs well"""
458457
xmin, xmax = -5, 5
459458
n_samples = 20
460459
tol = .001
461-
max_iter = 20
460+
max_iter = 50
462461
alpha = 0.1
463462
rng = np.random.RandomState(0)
464463
X = np.linspace(xmin, xmax, n_samples).reshape(n_samples, 1)
@@ -467,7 +466,7 @@ def test_sag_regressor():
467466
y = 0.5 * X.ravel()
468467

469468
clf1 = Ridge(tol=tol, solver='sag', max_iter=max_iter,
470-
alpha=alpha * n_samples)
469+
alpha=alpha * n_samples, random_state=rng)
471470
clf2 = clone(clf1)
472471
clf1.fit(X, y)
473472
clf2.fit(sp.csr_matrix(X), y)

0 commit comments

Comments
 (0)