SheffieldML / GPyOpt

Gaussian Process Optimization using GPy
BSD 3-Clause "New" or "Revised" License
929 stars 261 forks source link

Questions regarding BBO-LP. #129

Open theo20 opened 7 years ago

theo20 commented 7 years ago

I would like to run BBO-LP. First, I would like to have my initial design points e.g.

X = initial_design('latin',space,data_init) Y = myfunction(X)

Then, I use:

BO_demo_parallel = GPyOpt.methods.BayesianOptimization(f=myfunction, domain = domain, acquisition_type = 'EI', X=X, Y=Y, normalize_Y = True, initial_design_numdata = 2, evaluator_type = 'local_penalization', batch_size = batch_size, num_cores = num_cores, acquisition_jitter = 0)

  1. Does the GPy.Opt.methods.BayesianOptimziation command fits first the GP regression using the initial design points X, Y and then moves to the optimisation?
  2. By specifying X and Y as the initial inputs and outputs, what happen to the initial_design_numdata and initial_design_type? What exactly are these arguments?
  3. What if I don’t specify X and Y, from where we get the initial points?
  4. At each new iteration, from where the algorithm chooses the next point? Can I control this by specifying my design at each iteration?
  5. I run the example with Local Penalization available in github, GPyOpt: parallel Bayesian optimization, but I get an error during the optimisation process: Error in parallel computation. Fall back to single process. I also obtained the same error if I run my example.

Many thanks.

javiergonzalezh commented 7 years ago

Hi @theo20, this are the answers:

  1. Yes, it creates the object model and initialize it.
  2. If you pass already some X and Y initial_design_numdata and initial_design_type are ignored, as the class assumes that it doesn't need to generate them.
  3. Same as in 2, it will use those.
  4. Yes, you can specify your own design by creating a new acquisition of by passing the evaluations by hand.
  5. Can you share your code in this one. This has to do with the way the evaluation objective is parallelize, you may need to to that out of the loop if the current parallelization doesn't work.
theo20 commented 7 years ago

Hi @javiergonzalezh. Many thanks for your reply.

I am not sure if I need to create a new acquisition function. I am interested to optimise my function using the local penalisation type but at each iteration, I would like to know if I can specify a new dataset.

Let's say that my initial dataset contains 10 points and I want to run it for 10 iterations and set my batch size as 2. Then, in the evaluations file I end up with 30 iterations. From which dataset the algorithm choose the next 20 points? After the first iteration, can I set a new dataset of where I can get the new xt?

In terms of the error, I just used the example provided GPyOpt: parallel Bayesian optimization. In the report file says that the optimization is completed but while is running i get the error 'Error in parallel computation. Fall back to single process!'. Here is the code, same as in the link. Just to let you know I am running this using Canopy - Enthought.

import matplotlib.pyplot as plt import GPy import numpy as np import GPyOpt

from GPyOpt.methods import BayesianOptimization from GPyOpt.util.general import from numpy.random import seed from pylab import

objective_true = GPyOpt.objective_examples.experiments2d.branin() # true function objective_noisy = GPyOpt.objective_examples.experiments2d.branin(sd = 0.1) # noisy version bounds = objective_noisy.bounds

domain = [{'name': 'var_1', 'type': 'continuous', 'domain': bounds[0]}, ## use default bounds {'name': 'var_2', 'type': 'continuous', 'domain': bounds[1]}]

objective_true.plot()

batch_size = 2 num_cores = 4

seed(123) BO_demo_parallel = GPyOpt.methods.BayesianOptimization(f=objective_noisy.f,
domain = domain,
acquisition_type = 'EI',
normalize_Y = True, initial_design_numdata = 2, evaluator_type = 'local_penalization', batch_size = batch_size, num_cores = num_cores, acquisition_jitter = 0)

max_iter = 10
BO_demo_parallel.run_optimization(max_iter)

theo20 commented 7 years ago

Hi @javiergonzalezh.

How can I specify at each iteration a new dataset by creating a new acquisition function? I am not sure if I understand this. Thanks.

javiergonzalezh commented 6 years ago

You can specify a new data set by passing an new X and Y to the model. This is not an standard practice so, if you do this, be sure that the copies of X and Y are also updated in the BayesOpt object.