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

Target function is evaluated before the optimization is run #159

Open
sharpsy opened this issue Feb 5, 2018 · 4 comments
Open

Target function is evaluated before the optimization is run #159

sharpsy opened this issue Feb 5, 2018 · 4 comments

Comments

@sharpsy
Copy link

sharpsy commented Feb 5, 2018

When defining toy example like this:

import GPyOpt

def f(x):
    print(x)
    return (2*x)**2

bounds = [{'name': 'var_1', 'type': 'continuous', 'domain': (-1, 1)}]

task = GPyOpt.methods.BayesianOptimization(f, bounds)

We can see that the function is already evaluated five times. This function can be arbitrarily expensive to calculate and I believe it is a bug if it is implicitly evaluated five times before the optimization is run.

Using GPyOpt version 1.2.1 with GPy version 1.8.5 on Python 3.5.2

@cookiees0
Copy link

I'm not a dev, but there is an option "initial_design_numdata" which is defaulted to 5, and "initial_design_type" which is set to "random", since you need some amount of initial points. Both are easily changed and work well for me.

@sharpsy
Copy link
Author

sharpsy commented Feb 9, 2018

Tnx for clarification. I understand this design choice and I still think that this behavior looks unexpected; by defining the method for the optimization it already evaluates the target function. I accept that some amount of data points are needed in order for the method to work and would like for it to happen when explicitly told to. That way it could also take max_time, max_iter and other optimization parameters into account when the optimization is run that cannot be set with the constructor.

I can try to set initial_design_numdata to 0 to workaround this and increase the max_iter to account for it.

@farquet
Copy link
Contributor

farquet commented Feb 19, 2018

As a user, I also agree that this default value is counter-intuitive and should be set to 0.

@amarazov
Copy link

I also think that the default should be 0.

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

4 participants