Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Cannot use the batch_size>1 with local penalization evaluator #357

Open
blttkgl opened this issue Dec 6, 2021 · 1 comment
Open

Cannot use the batch_size>1 with local penalization evaluator #357

blttkgl opened this issue Dec 6, 2021 · 1 comment

Comments

@blttkgl
Copy link

blttkgl commented Dec 6, 2021

Hey all,

According to the issues I read in this repository, the batch_size>1 only works with the local_penalization evaluator, and not with sequential or any other evaluator model.

I have set up a Bayesian Optimization model where I use a GP surrogate model m trained on my dataset as my objective function, as follows:

def obj_func(X):
    out,_ = m.predict(X)
    return(out)

bo_step = GPyOpt.methods.BayesianOptimization(f = obj_func, domain = bounds,
                                                    model_type='GP',normalize_Y = False,
                                                    evaluator_type = 'local_penalization',
                                                    acquisition_type='EI',batch_size=5, maximize=True, eps=1e-8)

when I run the optimization, I only get a single prediction instead of batch_size=5:

bo_step.run_optimization(max_iter=5)

If I use the external object evaluation example as a starting point and use bo_step.suggest_next_locations() functions, I get 5 suggestions, but it seems that it does not really maximize my objective function (below). However I am not sure if I can/should use this object since I already have a surrogate model function fit into my dataset.

x_next = bo_step.suggest_next_locations()

Any help or suggestion on this is highly appreciated.

Best,

Bulut

@blttkgl
Copy link
Author

blttkgl commented Dec 6, 2021

Instead of using run_optimization, if I define my optimization as follows I get multiple points, but I am trying to understand the difference between this approach and the former I just posted:

prediction,_ = m.predict(X)
bo_step = GPyOpt.methods.BayesianOptimization(f = None, domain = bounds, X=X, Y=-prediction,
                                                    model_type='GP',normalize_Y = False,
                                                    evaluator_type = 'local_penalization',
                                                    acquisition_type='EI',batch_size=0, eps=1e-8)

x_next = bo_step.suggest_next_locations()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant