Skip to content
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

UserWarning: Choices for a categorical distribution should be a tuple of None, bool, int, float and str for persistent storage but contains #2341

Closed
majiang opened this issue Feb 13, 2021 · 2 comments
Assignees
Labels
question Question about Optuna.

Comments

@majiang
Copy link

majiang commented Feb 13, 2021

I have provided a list of tuples of integers, e.g. [(0,), (1, 2), (2, 3, 4)] as the choices argument of trial.suggest_categorical method.
The optimization session seems working while generating a number of (one for each choice?) warning as the title of this issue.

My question is that, what's the drawback I have to be aware of from the warning? Some possibilities I think of are, from worst:

  • it seems running, but the resulting FrozenTrial instances may have wrong results.
  • the result of optimization can be suboptimal.
  • the performance of optimization can be suboptimal.
  • I can't run this on multiple processes (with DB as storage).
  • nothing, because tuple of ints are actually allowed.
  • nothing, even when values of other types is provided.
@majiang majiang added the question Question about Optuna. label Feb 13, 2021
@himkt
Copy link
Member

himkt commented Feb 13, 2021

Hello @majiang, I think your optimization basically works without any problem.
You can use Optuna with the search space in parallel, and with RDB.

Some types such as tuple or dictionary are not recommended because there is no guarantee for compatibility across different storage backends (e.g. MySQL and Redis).

Not all types are guaranteed to be compatible with all storages. It is recommended to restrict the types of the choices to None, bool, int, float, and str.

(ref. documentation for CategoricalDistribution, documentation for CmaEsSampler, original PR)

@hvy Please tell/correct me if I missed/misunderstood some points. I ask you as you are the author of #758.

@himkt himkt assigned himkt and hvy Feb 13, 2021
@majiang
Copy link
Author

majiang commented Feb 13, 2021

Thank you @himkt for your prompt response. I'm glad my optimization basically works.

When compatibility issues become tangible I'll expect an Exception, and then encode the choices to strings.

Btw I had started the optimization with CmaEsSampler and thanks to your reference I have replaced it with TPESampler before wasting this night 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about Optuna.
Projects
None yet
Development

No branches or pull requests

3 participants