3333@pytest .mark .parametrize (
3434 "X, expected_voting" , [(X , "soft" ), (sparse .csr_matrix (X ), "hard" )]
3535)
36+ @pytest .mark .filterwarnings ("ignore:The default value of `n_init` will change" )
3637def test_fit_resample_check_voting (X , expected_voting ):
3738 cc = ClusterCentroids (random_state = RND_SEED )
3839 cc .fit_resample (X , Y )
3940 assert cc .voting_ == expected_voting
4041
4142
43+ @pytest .mark .filterwarnings ("ignore:The default value of `n_init` will change" )
4244def test_fit_resample_auto ():
4345 sampling_strategy = "auto"
4446 cc = ClusterCentroids (sampling_strategy = sampling_strategy , random_state = RND_SEED )
@@ -47,6 +49,7 @@ def test_fit_resample_auto():
4749 assert y_resampled .shape == (6 ,)
4850
4951
52+ @pytest .mark .filterwarnings ("ignore:The default value of `n_init` will change" )
5053def test_fit_resample_half ():
5154 sampling_strategy = {0 : 3 , 1 : 6 }
5255 cc = ClusterCentroids (sampling_strategy = sampling_strategy , random_state = RND_SEED )
@@ -55,6 +58,7 @@ def test_fit_resample_half():
5558 assert y_resampled .shape == (9 ,)
5659
5760
61+ @pytest .mark .filterwarnings ("ignore:The default value of `n_init` will change" )
5862def test_multiclass_fit_resample ():
5963 y = Y .copy ()
6064 y [5 ] = 2
@@ -69,7 +73,7 @@ def test_multiclass_fit_resample():
6973
7074def test_fit_resample_object ():
7175 sampling_strategy = "auto"
72- cluster = KMeans (random_state = RND_SEED )
76+ cluster = KMeans (random_state = RND_SEED , n_init = 1 )
7377 cc = ClusterCentroids (
7478 sampling_strategy = sampling_strategy ,
7579 random_state = RND_SEED ,
@@ -84,7 +88,7 @@ def test_fit_resample_object():
8488def test_fit_hard_voting ():
8589 sampling_strategy = "auto"
8690 voting = "hard"
87- cluster = KMeans (random_state = RND_SEED )
91+ cluster = KMeans (random_state = RND_SEED , n_init = 1 )
8892 cc = ClusterCentroids (
8993 sampling_strategy = sampling_strategy ,
9094 random_state = RND_SEED ,
@@ -111,6 +115,7 @@ def test_fit_resample_error(cluster_centroids_params, err_msg):
111115 cc .fit_resample (X , Y )
112116
113117
118+ @pytest .mark .filterwarnings ("ignore:The default value of `n_init` will change" )
114119def test_cluster_centroids_hard_target_class ():
115120 # check that the samples selecting by the hard voting corresponds to the
116121 # targeted class
0 commit comments