@@ -621,34 +621,11 @@ def test_sparse_cg_max_iter():
621621 assert_equal (reg .coef_ .shape [0 ], X_diabetes .shape [1 ])
622622
623623
624- def make_noisy_forward_data (
625- n_samples = 100 ,
626- n_features = 200 ,
627- n_targets = 10 ,
628- train_frac = .8 ,
629- noise_levels = None ,
630- random_state = 42 ):
631- """Creates a simple, dense, noisy forward linear model with multiple
632- output."""
633- rng = check_random_state (random_state )
634- n_train = int (train_frac * n_samples )
635- train = slice (None , n_train )
636- test = slice (n_train , None )
637- X = rng .randn (n_samples , n_features )
638- W = rng .randn (n_features , n_targets )
639- Y_clean = X .dot (W )
640- if noise_levels is None :
641- noise_levels = rng .randn (n_targets ) ** 2
642- noise_levels = np .atleast_1d (noise_levels ) * np .ones (n_targets )
643- noise = rng .randn (* Y_clean .shape ) * noise_levels * Y_clean .std (0 )
644- Y = Y_clean + noise
645- return X , Y , W , train , test
646-
647-
648624def test_ridge_gcv_with_sample_weights ():
649625
650626 n_samples , n_features , n_targets = 20 , 5 , 7
651- X , Y , W , _ , _ = make_noisy_forward_data (n_samples , n_features , n_targets )
627+ X , Y = datasets .make_regression (n_samples , n_features ,
628+ n_targets = n_targets )
652629 alphas = np .logspace (- 3 , 3 , 9 )
653630
654631 rng = np .random .RandomState (42 )
0 commit comments