Snochacz
Snochacz

Reputation: 725

Constraints on search space - python - scikit

I'm searching for minimum in 100d space. I'm using gp_minimize from skopt (python 3.6).

space = [(0., 1.) for _ in range(100)]
res = gp_minimize(f, space) 

However, I also have a constraint that value in each subsequent dimension is not larger than in the previous dimensions. For example for the case of 5d, point [1, 0.9, 0.9, 0.8, 0.7] is ok, while point [1, 0.3, 0.5, 0.4, 0.2] is not.

How to add this constraint using skopt?

Upvotes: 1

Views: 950

Answers (1)

Alex
Alex

Reputation: 33

The best way I found is to modify the function f. Choose an upper bound for f, and everywhere in the domain where f is not supposed to be evaluated, have it return this upper bound.

It is straightforward to this that this is a mathematically sound approach, as it doesn't change the minimum and constrains your search space kind of in the same way that Lagrange multipliers do. However, I don't know if it plays nicely with the algorithm, since I don't really know how Bayesian optimization handles wide plateaus.

Upvotes: 1

Related Questions