You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to treat the problem with related parameters? #355
The problem I am dealing with has 3 parameters, however, there is a constrained relation between x and y. For example, x+y should always be equal to 4. (x+y=4).
What can I do to make the BO give me the suggestions that satisfy the limits of x+y=4?
this particular problem can be solved by re-parameterizing your the original target and using a surrogate function, as outlined here.
In your specific case it could look something like this:
surrogate=lambdax, z: original_target_function(x=x, y=4-x, z=z)
# NB: your current bounds don't agree with your equality constraintpbounds= {'x': (2, 4), 'z':(3,5)}
and then proceed as usual.
Let me know if this helps.
this particular problem can be solved by re-parameterizing your the original target and using a surrogate function, as outlined here.
In your specific case it could look something like this:
surrogate=lambdax, z: original_target_function(x=x, y=4-x, z=z)
# NB: your current bounds don't agree with your equality constraintpbounds= {'x': (2, 4), 'z':(3,5)}
and then proceed as usual. Let me know if this helps.
thanks for your suggestion, but the function is unknown in my task, which means "surrogate = lambda x, z: original_target_function(x=x, y=4-x, z=z)" perhaps won't work.
Even if the function is unknown, your equality constraint reduces the degrees of freedom so your problem is dependent on 2 parameters instead of 3. If the relation imposed by the constraint is simple enough (as in your example) then it should be restatable in a form using fewer parameters quite easily.
To adapt your example, maybe something like this makes sense:
pbounds= {'x': (2, 4), 'z': (3,5)}
optimizer=BayesianOptimization(
f=None,
pbounds=pbounds,
verbose=2,
random_state=1
)
utility=UtilityFunction(kind="ucb", kappa=2.5, xi=0.05)
next_point_to_probe=optimizer.suggest(utility)
# 4 = x + y => y = 4 - xnext_point_to_probe['y'] =4-next_point_to_probe['x']
If this still doesn't work for your case, please provide a minimal, reproducible example (i.e. as described here) because I think I might be misunderstanding something about your problem.
Activity
t-muser commentedon Sep 20, 2022
Hi @UCASAlbert,
this particular problem can be solved by re-parameterizing your the original target and using a surrogate function, as outlined here.
In your specific case it could look something like this:
and then proceed as usual.
Let me know if this helps.
UCASAlbert commentedon Sep 21, 2022
thanks for your suggestion, but the function is unknown in my task, which means "surrogate = lambda x, z: original_target_function(x=x, y=4-x, z=z)" perhaps won't work.
t-muser commentedon Sep 21, 2022
Even if the function is unknown, your equality constraint reduces the degrees of freedom so your problem is dependent on 2 parameters instead of 3. If the relation imposed by the constraint is simple enough (as in your example) then it should be restatable in a form using fewer parameters quite easily.
To adapt your example, maybe something like this makes sense:
Out:
{'x': 2.8340440094051482, 'z': 4.440648986884316, 'y': 1.1659559905948518}If this still doesn't work for your case, please provide a minimal, reproducible example (i.e. as described here) because I think I might be misunderstanding something about your problem.
UCASAlbert commentedon Sep 21, 2022
thanks a lot for your comment. this seems really a feasible solution. thank you very much.
t-muser commentedon Sep 22, 2022
@bwheelz36 this can be closed I think.