Ax
Ax copied to clipboard
Error: A list of 'ChoiceParameter' is not iterable
While creating a list of choice parameters using dictionary:
parameters_list = [dict(name = parameter,
type = "choice",
values = [x,...]
) for parameter in all_parameters
]
it has warning UserWarning: sort_values
is not specified for ChoiceParameter
"xxx". Defaulting to True
for parameters of ParameterType
FLOAT. To override this behavior (or avoid this warning), specify sort_values
during ChoiceParameter
construction.
So if I want to avoid those warnings by creating my parameters using ChoiceParameter:
from ax import ChoiceParameter, ParameterType
[ChoiceParameter(name = parameter,
parameter_type = ParameterType.FLOAT,
values =[x,...],
is_ordered = True,
sort_values = False) for parameter in all_parameters]
it becomes an error
experiment = self.make_experiment(
File "/ax/lib/python3.9/site-packages/ax/service/utils/instantiation.py", line 908, in make_experiment
search_space=cls.make_search_space(parameters, parameter_constraints),
File "/ax/lib/python3.9/site-packages/ax/service/utils/instantiation.py", line 687, in make_search_space
typed_parameters = [cls.parameter_from_json(p) for p in parameters]
File "/ax/lib/python3.9/site-packages/ax/service/utils/instantiation.py", line 687, in
Although it's not critical, still better to have a way to pass "sort_values" through dict(), or having ChoiceParameter() iterable.