keras-tuner icon indicating copy to clipboard operation
keras-tuner copied to clipboard

BayesianOptimization tuner num_initial_points argument defaults to 2 if not specified

Open a2smith opened this issue 2 years ago • 2 comments

Describe the bug

BayesianOptimization tuner num_initial_points argument defaults to 2 if not specified. The description at https://keras.io/api/keras_tuner/tuners/bayesian/ states "If left unspecified, a value of 3 times the dimensionality of the hyperparameter space is used." which doesn't seem to be the case.

To Reproduce

You should be able to use the code at https://keras.io/guides/keras_tuner/getting_started/ (my code is similar) In the example, the search space size is 5 so num_initial_points should be 15 since it is not specified. The oracle.json file in the project folder still shows num_initial_points=2.

Expected behavior

If left unspecified, a value of 3 times the dimensionality of the hyperparameter space is used.

Additional context

Would you like to help us fix it?

a2smith avatar Jun 25 '22 13:06 a2smith

I think that you should set num_initial_points by yourself,and I think the bug should be fixed I try to add these code after the 243line in the "bayesian.py": num_initial_points = self.num_initial_points or 3 * dimensions ###(the origin code) print(num_initial_points) ###this is what I added and finally it prints"2" @haifeng-jin I don't if i did this correctly, I am new in github.Hope you can look at this

Fatigerrr avatar Sep 07 '22 13:09 Fatigerrr

The documentation should be changed. We it is always defaults to 2.

The file to be changed: https://github.com/keras-team/keras-tuner/blob/1.1.3/keras_tuner/tuners/bayesian.py#L218

haifeng-jin avatar Sep 13 '22 20:09 haifeng-jin