Closed Dvermetten closed 3 years ago
Describe the bug When setting the eval_type to 'list' in the following code, it throws an error, while it works properly with 'dict'.
To Reproduce `def test_mix_space(eval_type): dim_r = 2 # dimension of the real values def obj_fun(x): xr = np.array([x['continuous%d'%i] for i in range(dim_r)]) x_i = x['ordinal'] xd = x['nominal'] = 0 if x_d == 'OK' else 1 return np.sum(x_r * 2) + abs(xi - 10) / 123. + 2
search_space = ContinuousSpace([-5, 5], var_name='continuous') * dim_r + \ OrdinalSpace([5, 15], var_name='ordinal') + \ NominalSpace(['OK', 'A', 'B', 'C', 'D', 'E', 'F', 'G'], var_name='nominal') model = RandomForest(levels=search_space.levels) opt = ParallelBO( search_space=search_space, obj_fun=obj_fun, model=model, max_FEs=6, DoE_size=3, # the initial DoE size eval_type=eval_type, acquisition_fun='MGFI', acquisition_par={'t' : 2}, n_job=3, # number of processes n_point=3, # number of the candidate solution proposed in each iteration verbose=True # turn this off, if you prefer no output ) xopt, fopt, stop_dict = opt.run() print('xopt: {}'.format(xopt)) print('fopt: {}'.format(fopt)) print('stop criteria: {}'.format(stop_dict))`
Describe the bug When setting the eval_type to 'list' in the following code, it throws an error, while it works properly with 'dict'.
To Reproduce `def test_mix_space(eval_type): dim_r = 2 # dimension of the real values def obj_fun(x): xr = np.array([x['continuous%d'%i] for i in range(dim_r)]) x_i = x['ordinal'] xd = x['nominal'] = 0 if x_d == 'OK' else 1 return np.sum(x_r * 2) + abs(xi - 10) / 123. + 2