Constrains that include fixed or choice parameters raising an incorrect and confusing "Parameter does not exist in search space" exception
See original GitHub issueHello,
I am trying to have a fixed parameter in parameter_contrains of the experiment. The experiment setup looks like this:
ax_client.create_experiment(
name='experiment',
parameters=[
{
'name': 't1',
'type': 'fixed',
'value': t1,
'value_type': 'int'
},
{
'name': 't2',
'type': 'fixed',
'value': t2,
'value_type': 'int'
},
{
'name': 'lw',
'type': 'range',
'bounds': [0, lw_ub],
'value_type': 'int'
},
{
'name': 'rw',
'type': 'range',
'bounds': [0, rw_ub],
'value_type': 'int'
},
{
'name': 'dt2',
'type': 'range',
'bounds': [-max_delta_hit, max_delta_hit],
'value_type': 'int'
}
],
objective_name='mean_distance',
minimize=True,
parameter_constraints=[
f'lw + rw >= {min_width}',
f'rw + dt2 <= {data_len - t2}',
't1 - lw >= 0',
],
overwrite_existing_experiment=True
)
The setup seems to be OK. However, when I try to call ax_client.get_next_trial(ttl_seconds=30)
I get following error:
File "MY_PYTHON_PATH\lib\site-packages\ax\core\search_space.py", line 309, in _validate_parameter_constraints
raise ValueError(
ValueError: `t1` does not exist in search space.
The problem is that the SearchSpace class accepts only Range and Choice parameters. So I try to change the parameters from fixed to choice in the setup:
{
'name': 't1',
'type': 'choice',
'values': [t1, t1],
# 'value_type': 'int'
},
{
'name': 't2',
'type': 'choice',
'values': [t2, t2],
# 'value_type': 'int'
},
and it doesn’t work either. The names of the parameters change from t1
to t1_OH_PARAM_0
, so it again creates the same exception (parameters are not found). Also, the parameter values are in the range [0, 1]. Therefore, the constrain wouldn’t be satisfied.
I couldn’t find any restriction of parameters in the documentation of ax.core.parameter_constraint.ParameterConstraint
class.
May I ask you how to fix it? Is it even possible to have such constraints? If not, is there any workaround except checking the constraints manually in the evaluation function? This issue is probably similar to #574 or #383.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (8 by maintainers)
Top GitHub Comments
@petrcezner, we’ll look into this shortly, thank you for reporting!
@LuddeWessen, let me put this into a separate issue!