@@ -98,7 +98,7 @@ def test_runner(self) -> None:
9898 )
9999 for modified_bounds , noise_std in product (
100100 (None , [(0.0 , 2.0 )] * 6 ),
101- (0.0 , [ 0.1 ] * num_outcomes ),
101+ (0.0 , { name : 0.1 for name in outcome_names } ),
102102 )
103103 ]
104104 param_based_cases = [
@@ -108,11 +108,14 @@ def test_runner(self) -> None:
108108 num_outcomes ,
109109 )
110110 for num_outcomes in (1 , 2 )
111- for noise_std in (0.0 , [float (i ) for i in range (num_outcomes )])
111+ for noise_std in (
112+ 0.0 ,
113+ {f"objective_{ i } " : float (i ) for i in range (num_outcomes )},
114+ )
112115 ]
113116 surrogate_cases = [
114117 (get_soo_surrogate_test_function (lazy = False ), noise_std , 1 )
115- for noise_std in (0.0 , 1.0 , [ 0.0 ], [ 1.0 ] )
118+ for noise_std in (0.0 , 1.0 , { "branin" : 0.0 }, { "branin" : 1.0 } )
116119 ]
117120 for test_function , noise_std , num_outcomes in (
118121 botorch_cases + param_based_cases + surrogate_cases
@@ -137,11 +140,8 @@ def test_runner(self) -> None:
137140 ):
138141 self .assertIs (runner .test_function , test_function )
139142 self .assertEqual (runner .outcome_names , outcome_names )
140- if isinstance (noise_std , list ):
141- self .assertEqual (
142- runner .get_noise_stds (),
143- dict (zip (runner .outcome_names , noise_std )),
144- )
143+ if isinstance (noise_std , dict ):
144+ self .assertEqual (runner .get_noise_stds (), noise_std )
145145 else : # float
146146 self .assertEqual (
147147 runner .get_noise_stds (),
@@ -244,15 +244,17 @@ def test_runner(self) -> None:
244244 set (runner .test_function .outcome_names ), set (res .keys ())
245245 )
246246
247- for i , df in enumerate (res .values ()):
248- if isinstance (noise_std , list ):
249- self .assertEqual (df ["sem" ].item (), noise_std [i ])
250- if all (n == 0 for n in noise_std ):
251- self .assertTrue (np .array_equal (df ["mean" ], Y [i , :]))
247+ for outcome_name , df in res .items ():
248+ if isinstance (noise_std , dict ):
249+ self .assertEqual (df ["sem" ].item (), noise_std [outcome_name ])
250+ if all (n == 0 for n in noise_std .values ()):
251+ Y_idx = runner .outcome_names .index (outcome_name )
252+ self .assertTrue (np .array_equal (df ["mean" ], Y [Y_idx , :]))
252253 else : # float
253254 self .assertEqual (df ["sem" ].item (), noise_std )
254255 if noise_std == 0 :
255- self .assertTrue (np .array_equal (df ["mean" ], Y [i , :]))
256+ Y_idx = runner .outcome_names .index (outcome_name )
257+ self .assertTrue (np .array_equal (df ["mean" ], Y [Y_idx , :]))
256258
257259 with self .subTest (f"test `poll_trial_status()`, { test_description } " ):
258260 self .assertEqual (
@@ -321,14 +323,10 @@ def test_get_noise_stds(self) -> None:
321323 )
322324 self .assertDictEqual (runner .get_noise_stds (), expected_noise_sd_dict )
323325
324- with self .subTest ("list noise_std" ):
325- runner = BenchmarkRunner (test_function = test_function , noise_std = [1.0 ])
326- self .assertDictEqual (runner .get_noise_stds (), expected_noise_sd_dict )
327-
328326 def test_heterogeneous_noise (self ) -> None :
329327 outcome_names = ["objective_0" , "constraint" ]
330328 noise_dict = {"objective_0" : 0.1 , "constraint" : 0.05 }
331- for noise_std in [[ 0.1 , 0.05 ], noise_dict ]:
329+ for noise_std in [noise_dict ]:
332330 runner = BenchmarkRunner (
333331 test_function = BoTorchTestFunction (
334332 botorch_problem = ConstrainedHartmann (dim = 6 ),
0 commit comments