@@ -278,7 +278,7 @@ def test_consistency_path():
278278
279279def test_liblinear_dual_random_state ():
280280 # random_state is relevant for liblinear solver only if dual=True
281- X , y = make_classification (n_samples = 20 )
281+ X , y = make_classification (n_samples = 20 , random_state = 0 )
282282 lr1 = LogisticRegression (random_state = 0 , dual = True , max_iter = 1 , tol = 1e-15 )
283283 lr1 .fit (X , y )
284284 lr2 = LogisticRegression (random_state = 0 , dual = True , max_iter = 1 , tol = 1e-15 )
@@ -295,7 +295,7 @@ def test_liblinear_dual_random_state():
295295
296296
297297def test_logistic_loss_and_grad ():
298- X_ref , y = make_classification (n_samples = 20 )
298+ X_ref , y = make_classification (n_samples = 20 , random_state = 0 )
299299 n_features = X_ref .shape [1 ]
300300
301301 X_sp = X_ref .copy ()
@@ -403,7 +403,8 @@ def test_multinomial_logistic_regression_string_inputs():
403403 # Test with string labels for LogisticRegression(CV)
404404 n_samples , n_features , n_classes = 50 , 5 , 3
405405 X_ref , y = make_classification (n_samples = n_samples , n_features = n_features ,
406- n_classes = n_classes , n_informative = 3 )
406+ n_classes = n_classes , n_informative = 3 ,
407+ random_state = 0 )
407408 y_str = LabelEncoder ().fit (['bar' , 'baz' , 'foo' ]).inverse_transform (y )
408409 # For numerical labels, let y values be taken from set (-1, 0, 1)
409410 y = np .array (y ) - 1
@@ -745,7 +746,7 @@ def test_multinomial_logistic_regression_with_classweight_auto():
745746def test_logistic_regression_convergence_warnings ():
746747 # Test that warnings are raised if model does not converge
747748
748- X , y = make_classification (n_samples = 20 , n_features = 20 )
749+ X , y = make_classification (n_samples = 20 , n_features = 20 , random_state = 0 )
749750 clf_lib = LogisticRegression (solver = 'liblinear' , max_iter = 2 , verbose = 1 )
750751 assert_warns (ConvergenceWarning , clf_lib .fit , X , y )
751752 assert_equal (clf_lib .n_iter_ , 2 )
@@ -834,7 +835,7 @@ def test_liblinear_decision_function_zero():
834835 # are zero. This is a test to verify that we do not do the same.
835836 # See Issue: https://github.com/scikit-learn/scikit-learn/issues/3600
836837 # and the PR https://github.com/scikit-learn/scikit-learn/pull/3623
837- X , y = make_classification (n_samples = 5 , n_features = 5 )
838+ X , y = make_classification (n_samples = 5 , n_features = 5 , random_state = 0 )
838839 clf = LogisticRegression (fit_intercept = False )
839840 clf .fit (X , y )
840841
@@ -846,7 +847,7 @@ def test_liblinear_decision_function_zero():
846847def test_liblinear_logregcv_sparse ():
847848 # Test LogRegCV with solver='liblinear' works for sparse matrices
848849
849- X , y = make_classification (n_samples = 10 , n_features = 5 )
850+ X , y = make_classification (n_samples = 10 , n_features = 5 , random_state = 0 )
850851 clf = LogisticRegressionCV (solver = 'liblinear' )
851852 clf .fit (sparse .csr_matrix (X ), y )
852853
0 commit comments