@@ -970,8 +970,8 @@ def test_zero_division_nan_warning(metric, y_true, y_pred):
970
970
assert result == 0.0
971
971
972
972
973
- def test_matthews_corrcoef_against_numpy_corrcoef ():
974
- rng = np .random .RandomState (0 )
973
+ def test_matthews_corrcoef_against_numpy_corrcoef (global_random_seed ):
974
+ rng = np .random .RandomState (global_random_seed )
975
975
y_true = rng .randint (0 , 2 , size = 20 )
976
976
y_pred = rng .randint (0 , 2 , size = 20 )
977
977
@@ -980,11 +980,11 @@ def test_matthews_corrcoef_against_numpy_corrcoef():
980
980
)
981
981
982
982
983
- def test_matthews_corrcoef_against_jurman ():
983
+ def test_matthews_corrcoef_against_jurman (global_random_seed ):
984
984
# Check that the multiclass matthews_corrcoef agrees with the definition
985
985
# presented in Jurman, Riccadonna, Furlanello, (2012). A Comparison of MCC
986
986
# and CEN Error Measures in MultiClass Prediction
987
- rng = np .random .RandomState (0 )
987
+ rng = np .random .RandomState (global_random_seed )
988
988
y_true = rng .randint (0 , 2 , size = 20 )
989
989
y_pred = rng .randint (0 , 2 , size = 20 )
990
990
sample_weight = rng .rand (20 )
@@ -1019,8 +1019,8 @@ def test_matthews_corrcoef_against_jurman():
1019
1019
assert_almost_equal (mcc_ours , mcc_jurman , 10 )
1020
1020
1021
1021
1022
- def test_matthews_corrcoef ():
1023
- rng = np .random .RandomState (0 )
1022
+ def test_matthews_corrcoef (global_random_seed ):
1023
+ rng = np .random .RandomState (global_random_seed )
1024
1024
y_true = ["a" if i == 0 else "b" for i in rng .randint (0 , 2 , size = 20 )]
1025
1025
1026
1026
# corrcoef of same vectors must be 1
@@ -1054,8 +1054,8 @@ def test_matthews_corrcoef():
1054
1054
assert_almost_equal (matthews_corrcoef (y_1 , y_2 , sample_weight = mask ), 0.0 )
1055
1055
1056
1056
1057
- def test_matthews_corrcoef_multiclass ():
1058
- rng = np .random .RandomState (0 )
1057
+ def test_matthews_corrcoef_multiclass (global_random_seed ):
1058
+ rng = np .random .RandomState (global_random_seed )
1059
1059
ord_a = ord ("a" )
1060
1060
n_classes = 4
1061
1061
y_true = [chr (ord_a + i ) for i in rng .randint (0 , n_classes , size = 20 )]
@@ -1111,9 +1111,9 @@ def test_matthews_corrcoef_multiclass():
1111
1111
1112
1112
1113
1113
@pytest .mark .parametrize ("n_points" , [100 , 10000 ])
1114
- def test_matthews_corrcoef_overflow (n_points ):
1114
+ def test_matthews_corrcoef_overflow (n_points , global_random_seed ):
1115
1115
# https://github.com/scikit-learn/scikit-learn/issues/9622
1116
- rng = np .random .RandomState (20170906 )
1116
+ rng = np .random .RandomState (global_random_seed )
1117
1117
1118
1118
def mcc_safe (y_true , y_pred ):
1119
1119
conf_matrix = confusion_matrix (y_true , y_pred )
0 commit comments