I use Bayesian Optimization package (https://github.com/fmfn/BayesianOptimization) for parameter optimization. By default this library iterate over float points number but i neet iterate over integers, how can i perform that?
def black_box_function(x, y):
return -x ** 2 - (y - 1) ** 2 + 1
from bayes_opt import BayesianOptimization
pbounds = {'x': (2, 4), 'y': (-3, 3)}
optimizer = BayesianOptimization(
f=black_box_function,
pbounds=pbounds,
verbose=2,
random_state=1,
)
optimizer.maximize(
init_points=2,
n_iter=3,
)
# and as you can see it is iterated not over integers.
| iter | target | x | y |
-------------------------------------------------
| 1 | -7.135 | 2.834 | 1.322 |
| 2 | -7.78 | 2.0 | -1.186 |
| 3 | -19.0 | 4.0 | 3.0 |
| 4 | -16.3 | 2.378 | -2.413 |
| 5 | -4.441 | 2.105 | -0.005822 |
=================================================
You may read part 2 of the advanced tour for this.