@@ -1027,13 +1027,13 @@ def test_logistic_regression_solvers_multiclass_unpenalized(
10271027 """Test and compare solver results for unpenalized multinomial multiclass."""
10281028 # We want to avoid perfect separation.
10291029 n_samples , n_features , n_classes = 100 , 4 , 3
1030- rng = np .random .RandomState (global_random_seed )
1030+ rng = np .random .default_rng (global_random_seed )
10311031 X = make_low_rank_matrix (
10321032 n_samples = n_samples ,
10331033 n_features = n_features + fit_intercept ,
10341034 effective_rank = n_features + fit_intercept ,
10351035 tail_strength = 0.1 ,
1036- random_state = rng ,
1036+ random_state = rng . integers ( 2 ** 31 ) ,
10371037 )
10381038 if fit_intercept :
10391039 X [:, - 1 ] = 1
@@ -1049,10 +1049,7 @@ def test_logistic_regression_solvers_multiclass_unpenalized(
10491049
10501050 loss = HalfMultinomialLoss (n_classes = n_classes )
10511051 proba = loss .link .inverse (raw_prediction )
1052- # Only newer numpy version (1.22) support more dimensions on pvals.
1053- y = np .zeros (n_samples )
1054- for i in range (n_samples ):
1055- y [i ] = np .argwhere (rng .multinomial (n = 1 , pvals = proba [i , :]))[0 , 0 ]
1052+ y = np .nonzero (rng .multinomial (n = 1 , pvals = proba ))[1 ]
10561053
10571054 tol = 1e-9
10581055 params = dict (fit_intercept = fit_intercept , random_state = global_random_seed )
0 commit comments