-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constraints seem not to work. #37
Comments
我也有同样的问题,目前看上去有两个地方会违反约束:
|
In OpenBox, constraints are considered to be black-box, which means only after the configuration is evaluated, you can observe whether the constraints are violated. In the optimization process, OpenBox tries to find feasible solutions, but does not guarantee the black-box constraints are 100% satisfied. However, I see that the constraints you set are between input hyperparameters (feature_dims1 > feature_dims2 > feature_dims3). The optimizer should be able to filter invalid suggestions before execution. Unfortunately, the Here is an example: from openbox import space as sp
def sample_condition(config):
# require x1 <= x2 and x1 * x2 < 100
if config['x1'] > config['x2']:
return False
if config['x1'] * config['x2'] >= 100:
return False
return True
# return config['x1'] <= config['x2'] and config['x1'] * config['x2'] < 100
cs = sp.ConditionedSpace()
cs.add_variables([...])
cs.set_sample_condition(sample_condition) # set the sample condition after all variables are added You are welcomed to report any bugs encountered. |
By the way, in the latest version (0.6.0) of However, it does not support more complex constraints like Here I try to write an example using from ConfigSpace import ForbiddenGreaterThanRelation, ForbiddenEqualsRelation, ForbiddenLessThanRelation
from openbox import space as sp
space = sp.Space()
space.add_variables([...])
# we want x1 <= x2, then x1 > x2 is forbidden
fr = ForbiddenGreaterThanRelation(space['x1'], space['x2'])
space.add_forbidden_clause(fr) Refer to their docs and issues for more details: |
@yuixzero By using |
I add 2 constrains in results from objective_function, hope "feature_dims1 > feature_dims2 > feature_dims3", but it seems not to work as expect.
The text was updated successfully, but these errors were encountered: