question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Constrains that include fixed or choice parameters raising an incorrect and confusing "Parameter does not exist in search space" exception

See original GitHub issue

Hello,

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:closed
  • Created 2 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
lena-kashtelyancommented, Jul 14, 2021

@petrcezner, we’ll look into this shortly, thank you for reporting!

1reaction
lena-kashtelyancommented, Oct 26, 2021

@LuddeWessen, let me put this into a separate issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source code for ax.service.ax_client
experiment.parameters: raise ValueError( f'Parameter "{param_x}" not found in the optimization search space.' ) if param_y not in self.experiment.parameters: ...
Read more >
CA2208: Instantiate argument exceptions correctly
An incorrect string argument is passed to a parameterized constructor of an exception type that is, or derives from, ArgumentException. One of ...
Read more >
Hibernate Validator 8.0.0.Final - Jakarta Bean ...
The validate() method returns a set of ConstraintViolation instances, which you can iterate over in order to see which validation errors ...
Read more >
Warning Options (Using the GNU Compiler Collection (GCC))
Warnings are diagnostic messages that report constructions that are not inherently erroneous but that are risky or suggest there may have been an...
Read more >
How to Grid Search Hyperparameters for Deep Learning ...
Hyperparameter optimization is a big part of deep learning. The reason is that neural networks are notoriously difficult to configure, and a lot ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found